1

I work on a multi module maven project with osgi bundles deployed to karaf. We are observing intermittent bundle start-up issues in our test and production environments due to the below error, which is later resolved after restarting the karaf container:

Caused by: org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve resource myBundle [myBundle [16](R 16.0)] because it is exposed to package 'javax.el' from resources javax.el-api [javax.el-api [236](R 236.0)] and com.sun.el.javax.el [com.sun.el.javax.el [212](R 212.0)] via two dependency chains.

Chain 1:
  myBundle [myBundle [16](R 16.0)]
    import: (&(osgi.wiring.package=javax.el)(version>=3.0.0)(!(version>=4.0.0)))
     |
    export: osgi.wiring.package: javax.el
  javax.el-api [javax.el-api [236](R 236.0)]

Chain 2:
  myBundle [myBundle [16](R 16.0)]
    import: (&(osgi.wiring.package=com.sun.el)(version>=3.0.0)(!(version>=4.0.0)))
     |
    export: osgi.wiring.package: com.sun.el; uses:=javax.el
    export: osgi.wiring.package=javax.el
  com.sun.el.javax.el [com.sun.el.javax.el [212](R 212.0)] Unresolved requirements: [[myBundle [16](R 16.0)] osgi.wiring.package; (&(osgi.wiring.package=com.sun.el)(version>=3.0.0)(!(version>=4.0.0)))]
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4111)[org.apache.felix.framework-5.4.0.jar:]
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2117)[org.apache.felix.framework-5.4.0.jar:]
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)[org.apache.felix.framework-5.4.0.jar:]
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)[org.apache.felix.framework-5.4.0.jar:]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1286)[10:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:846)[10:org.apache.karaf.features.core:4.0.7]
        ... 6 more

I went through these 2 related SO posts (Error starting bundle in karaf: "via two dependency chains" and Why are uses constraints violated when both chains end in the same bundle? ) but in my situation I am actually unable to determine where from the javax.el-api dependency is being introduced to myBundle. Our project uses Hibernate Validator, which requires the EL package from glassfish jar, so this is where the com.sun.el.javax.el package dependency is introduced. I was unable to determine where the javax.el-api dependency is being introduced from though. I tried checking the dependency tree using the below maven commands but to no avail.

mvn compile dependency:tree
mvn compile dependency:tree -D:verbose
mvn compile dependency:tree -D:verbose -Dincludes=javax.el

This is the dependency added for hibernate validator:

<dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.el</artifactId>
    <version>3.0.1-b08</version>
</dependency>

The karaf version being used is 4.0.7

Any help will be appreciated.

Sanjeev R
  • 43
  • 6
  • 1
    It seems to me that your bundle is also exporting the javax.el class, can you show me your MANIFEST.MF file? – Cλstor Aug 21 '18 at 22:47
  • @Cλstor Looks like another bundle in the project is dependent on a conflicting version of javax.el class; it is being investigated. Meanwhile I cannot share the manifest file for that bundle, but if it helps I do not see any conflicting javax.el versions in there. I only see this: `"javax.el;version="[3.0,4)""` – Sanjeev R Aug 27 '18 at 12:24

0 Answers0