Javax.Inject Dependency Error | Community
Skip to main content
Himanshu_Singhal
Community Advisor
Community Advisor
November 9, 2016
Solved

Javax.Inject Dependency Error

  • November 9, 2016
  • 5 replies
  • 3710 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by sureshr31455031

Following changes worked for me against AEM 6.1 SP2.

5 replies

smacdonald2008
November 9, 2016

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...

Gdubz-57m2mu
November 9, 2016

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/e8239a911fe08029f7e7abfe210f1e49709f99c0

That should be all you need!

Himanshu_Singhal
Community Advisor
Community Advisor
November 14, 2016

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)
Feike_Visser1
Adobe Employee
Adobe Employee
November 14, 2016

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

sureshr31455031Accepted solution
November 18, 2016

Following changes worked for me against AEM 6.1 SP2.