I'm trying to use the servlet-api version 3 in an Adobe CQ5 installation, without much success.
there is already a bundle that exports the javax.servlet package (version 2.5), so I deployed a bundle with version 3.1.0. this bundle starts ok.
The problem is starting the bundle that uses the api v3. I am getting an OSGi exception that I cannot fully understand:
POST /system/console/bundles/250 HTTP/1.1] cqse-httpservice %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException:
Constraint violation for package 'javax.servlet' when resolving module 250.9 between existing import 266.0.javax.servlet
BLAMED ON [[250.9] package; (&(package=javax.servlet)(version>=3.0.0)(!(version>=4.0.0)))]
and uses constraint 22.1.javax.servlet
BLAMED ON [[250.9] package; (package=com.day.cq.wcm.foundation.forms), [210.0] package; (&(package=org.apache.sling.api.resource)(version>=2.0.0)), [93.0] package; (&(package=javax.servlet)(version>=2.4.0))])
- bundle 266 exports javax.servlet v=3.10 (I installed this one)
- bundle 22 exports javax.servlet v=2.5 (provided by CQ5)
- bundle 250 (mine) imports javax.servlet,version=[3.0,4) from 266. It also imports packages from 210 and 93.
- bundle 210 imports javax.servelt v=2.5 from 22 (but the import in manifest does not have a version. maybe this is the problem?)
- bundle 93 has javax.servlet; version="2.4" in the Import-package. but it resolved to javax.servlet,version=2.5.0 from (22) somehow.
The problem seems to be around the dependencies of bundle 250, but Im not sure what is the problem. AFAIK two versions of a package can coexist in an OSGi container. bundles 210 and 93 are running without issues.