AEM/CQ - javax.xml.namespace can't resolve OSGI dependency

Avatar

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
jineetv21622325
Level 1

05-06-2017

'm using AEM 6.2 and I'm currently implementing WebService. I included all dependency jars in OSGI bundle which I created externally and all dependency issue got resolved except one:

javax.xml.namespace,version=[1.0,2) -- Cannot be resolved

When I checked in the maven using depfinder tool, it showed me as below:

<dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.fragment.ws</artifactId> <version>1.0.2</version> <scope>provided</scope> </dependency>

However, in my other custom project, the javax.xml.namespace is showing resolved state.

I'm stuck in this situation and any pointers will be really appreciated.

Thanks, Jineet

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

05-06-2017

You should be using the Dependency finder that i referenced in this thread and then get that into you Dependencies section of your POM. For AEM 6.2 - see this:

dd1.png

Answers (16)

Answers (16)

Avatar

Avatar
Give Back 3
Level 1
MrynalKumar
Level 1

Like

1 like

Total Posts

6 posts

Correct reply

0 solutions
Top badges earned
Give Back 3
Give Back
Boost 1
View profile

Avatar
Give Back 3
Level 1
MrynalKumar
Level 1

Like

1 like

Total Posts

6 posts

Correct reply

0 solutions
Top badges earned
Give Back 3
Give Back
Boost 1
View profile
MrynalKumar
Level 1

27-04-2020

@jineetv21622325 , I also faced similar error while upgrading from AEM 6.3 to 6.5 SP4. 

 

Error Log -

24.03.2020 15:09:40.573 *ERROR* [qtp1041007297-2360] org.apache.felix.http.jetty %bundles.pluginTitle: 
Cannot start (org.osgi.framework.BundleException: Unable to resolve com.XXX.XXXX.XXX [590](R 590.0):
missing requirement [com.XXX.XXX.XXX [590](R 590.0)] osgi.wiring.package;
(&(osgi.wiring.package=javax.xml.namespace)(version>=0.0.0)(!(version>=1.0.0)))
Unresolved requirements: [[com.XXX.XXX.XXX [590](R 590.0)]
osgi.wiring.package; (&(osgi.wiring.package=javax.xml.namespace)(version>=0.0.0)(!(version>=1.0.0)))])
org.osgi.framework.BundleException: Unable to resolve com.XXX.XXX.XXX [590](R 590.0): missing requirement

 

Reason - 

As you see in the error log above, Bundle Exception is due to failed OSGI Wiring. Version of javax.xml.namespace is not suffiecient or compatible enough. 

 

Solution -

Avatar

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
jineetv21622325
Level 1

05-06-2017

smacdonald2008​, I found that if I include org.apache.axis2 dependency, the bundle shows unresolved for javax.xml.namespace. But on removing org.apache.axis2 dependency, the bundle goes in resolved state.

I'm implementing web service using Apache Axis 2 and I need to use this dependency for my project work.

Not sure what conflict it is creating with Apache Axis 2 API.

Thanks,

Jineet

Avatar

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
jineetv21622325
Level 1

05-06-2017

AEM v6.2, Uber Jar v6.2.0, archetype v10.

Avatar

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
jineetv21622325
Level 1

05-06-2017

smacdonald2008 What should be the dependency added in pom.xml to make it pick appropriate version?

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

05-06-2017

I have done this from time to time when i need to get it to work But correct - the ideal way is to get it correct in the POM file!

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,141 likes

Total Posts

3,167 posts

Correct reply

1,084 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,141 likes

Total Posts

3,167 posts

Correct reply

1,084 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

05-06-2017

Hi Scott,

this doesn't help if you need to do it again and again after every build 🙂

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

05-06-2017

Here is a tip (but you would need to do it each time you build the bundle) - open the bundle in ZIP tool. Open the  Manifest file.

Remove the version information beside the package - then it will pick up the available version in AEM.

package.png

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,141 likes

Total Posts

3,167 posts

Correct reply

1,084 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,141 likes

Total Posts

3,167 posts

Correct reply

1,084 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

05-06-2017

Hi,

There's a version mismatch, so it looks like you compile against a wrong version of the AEM uber jar. What version of the uber.jar are you using and what version of AEM are you targetting? Or: what version of the AEM archetype are you using?

regards,

Jörg

Avatar

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
jineetv21622325
Level 1

05-06-2017

Using AEM 6.2, archetype 10 and using Uber Jar as well.

Avatar

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
jineetv21622325
Level 1

05-06-2017

Thanks smacdonald2008​, I did find the dependency by entering javax.xml.namespace and below is the result returned:

Package: javax.xml.namespace

Version: 0.0.0.fragment_xml

Exported by: org.apache.felix.framework (0)

Maven dependency:

<dependency>

     <groupId>org.apache.sling</groupId>

     <artifactId>org.apache.sling.fragment.ws</artifactId>

     <version>1.0.2</version>

     <scope>provided</scope>

</dependency>

And in my bundle: it is showing me this - javax.xml.namespace,version=[1.0,2) -- Cannot be resolved

If this is an version issue, can you please tell me what I should I do to make this package resolved?

Many thanks,Jineet

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

05-06-2017

What AEM version are you using?

If you are using AEM 6.2 - you should be using Maven Archetype 10 and AEM uber 6.2 JAR to resolve the dependencies. See this article --

Scott's Digital Community: Creating your first AEM 6.2 Project using Adobe Maven Archetype 10

Avatar

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
jineetv21622325
Level 1

05-06-2017

The bundle which resolves:
javax.xml.namespace,version=0.0.0.fragment_xml from org.apache.felix.framework (0)
The bundle which doesn't resolve:
javax.xml.namespace,version=[1.0,2) -- Cannot be resolved

Avatar

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
jineetv21622325
Level 1

Like

1 like

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
jineetv21622325
Level 1

05-06-2017

Error log:
5.06.2017 23:11:22.800 *ERROR* [qtp110252325-58675] org.apache.felix.http.jetty %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException: Unable to resolve com.xyz.cq.support.core [515](R 515.2): missing requirement [com.xyz.cq.support.core [515](R 515.2)] osgi.wiring.package; (&(osgi.wiring.package=javax.xml.namespace)(version>=1.0.0)(!(version>=2.0.0))) Unresolved requirements: [[com.xyz.cq.support.core [515](R 515.2)] osgi.wiring.package; (&(osgi.wiring.package=javax.xml.namespace)(version>=1.0.0)(!(version>=2.0.0)))])

org.osgi.framework.BundleException: Unable to resolve com.xyz.cq.support.core [515](R 515.2): missing requirement [com.xyz.cq.support.core [515](R 515.2)] osgi.wiring.package; (&(osgi.wiring.package=javax.xml.namespace)(version>=1.0.0)(!(version>=2.0.0))) Unresolved requirements: [[com.xyz.cq.support.core [515](R 515.2)] osgi.wiring.package; (&(osgi.wiring.package=javax.xml.namespace)(version>=1.0.0)(!(version>=2.0.0)))]

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

05-06-2017

Also use the Dependency Finder in AEM to see what version AEM has installed. For information about the Dep Finder - see The Real CQ: CQ5/AEM How do I find out exactly which maven dependency I need?

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,410 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

05-06-2017

In your bundle that does resolve - are you referencing same version. Looks like a version conflict.

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,141 likes

Total Posts

3,167 posts

Correct reply

1,084 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,141 likes

Total Posts

3,167 posts

Correct reply

1,084 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

05-06-2017

Can you please post relevant import statements of the bundle, which does not resolve? Can you also check your error.log file if there is a statement about this sling fragment?

kind regards,
Jörg