Expand my Community achievements bar.

SOLVED

Javax.Inject Dependency Error

Avatar

Community Advisor

I'm getting this error while installing bundle.

org.osgi.framework.BundleException: Unresolved constraint in bundle common-utility.core [574]: Unable to resolve 574.0: missing requirement [574.0] osgi.wiring.package; (&(osgi.wiring.package=javax.inject)(version>=1.0.0)(!(version>=2.0.0)))
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4095)

 

Please help me to resolve this issue.

1 Accepted Solution

Avatar

Correct answer by
Level 2

Following changes worked for me against AEM 6.1 SP2.

View solution in original post

5 Replies

Avatar

Level 10

You have dependency issues. See this artilce to learn how to use Maven 10 archetype and proper AEM Urber JAR: 

https://helpx.adobe.com/experience-manager/using/first_htl_WCMUsePojo.html

In the Parent POM - you need: 

<dependency>
               <groupId>com.adobe.aem</groupId>
               <artifactId>uber-jar</artifactId>
               <version>6.2.0</version>
               <!-- for AEM6.1 use this version     : <version>6.1.0</version> -->
               <!-- for AEM6.1 SP1 use this version : <version>6.1.0-SP1-B0001</version> -->
               <!-- for AEM6.1 SP2 use this version : <version>6.1.0-SP2</version> -->
               <!-- for AEM6.2 use this version     : <version>6.2.0</version> -->
               <classifier>obfuscated-apis</classifier>
               <scope>provided</scope>
           </dependency>
            
           <dependency>
               <groupId>org.apache.geronimo.specs</groupId>
               <artifactId>geronimo-atinject_1.0_spec</artifactId>
               <version>1.0</version>
               <scope>provided</scope>
           </dependency>

 

In the POM under core - you need: 

 <dependency>
            <groupId>com.adobe.aem</groupId>
            <artifactId>uber-jar</artifactId>
            <classifier>obfuscated-apis</classifier>
        </dependency>
 
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-atinject_1.0_spec</artifactId>
        </dependency>

 

Hope this helps...

Avatar

Level 5

Assuming you're using the Maven AEM Project Archetype 10, then you need to add the following line to your "maven-bundle-plugin", under <configuration><instructions>...

<!-- Import any version of javax.inject, to allow running on multiple versions of AEM --> <Import-Package>javax.inject;version=0.0.0,*</Import-Package>

See the commit diff from Issue #59 here: https://github.com/Adobe-Marketing-Cloud/aem-project-archetype/commit/e8239a911fe08029f7e7abfe210f1e...

That should be all you need!

Avatar

Community Advisor

I'm still getting this error : 

12.11.2016 12:49:43.355 *INFO* [OsgiInstallerImpl] org.apache.sling.installer.core.impl.tasks.BundleStartTask Could not start bundle common-utility.core [579]. Reason: {}. Will retry.
org.osgi.framework.BundleException: Unresolved constraint in bundle common-utility.core [579]: Unable to resolve 579.0: missing requirement [579.0] osgi.wiring.package; (&(osgi.wiring.package=javax.inject)(version>=0.0.0))
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4095)

Avatar

Employee

Make sure you remove the 6.0 uber-jar, and have the uber jar as the first dependency.

Example here: https://github.com/heervisscher/htl-examples

Avatar

Correct answer by
Level 2

Following changes worked for me against AEM 6.1 SP2.