Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

LinkageError: have different Class objects for the type javax/xml/namespace

870199Mar 21 2012 — edited Mar 22 2012
In order to be able to connect to a Webservice, we have a standalone client written as follows, which works fine.

URL wsdlLocation = new URL(wsdlURL);
javax.xml.namespace.QName serviceName = new QName("http://nbi2.service.xyz.123.com/", "NBIService");
javax.xml.ws.Service s = Service.create(wsdlLocation, serviceName);
nbiService = s.getPort(NBIService.class);

But when i run it from one other environment [Java 6] I get following error in line: javax.xml.ws.Service s = Service.create(wsdlLocation, serviceName);

java.lang.LinkageError: loader constraint violation:
when resolving method "javax.xml.ws.Service.create(Ljava/net/URL;Ljavax/xml/namespace/QName;)Ljavax/xml/ws/Service;"
the class loader (instance of xyz/instrumentation/datasourcemgr/NonDelegatingJarClassLoader) of the current class, xyz/abc/nbiclientutils/NBI2ServiceWSClientProxy,
and the class loader (instance of <bootloader>) for resolved class, javax/xml/ws/Service,
have different Class objects for the type javax/xml/namespace/QName used in the signature

I found that Java 6's rt.jar also two version's of class QName:
One with package: com\sun\org\apache\xalan\internal\xsltc\compiler
Another with: javax\xml\namespace

I hope that's not an issue here, I checked the code javax.xml.ws.Service in link: http://www.docjar.com/html/api/javax/xml/ws/Service.java.html
That class also imports the same "javax/xml/namespace/QName"

So may be two different versions of QName has been created in VM

Please advise, how to get over this issue??

Edited by: 867196 on Mar 21, 2012 9:08 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 19 2012
Added on Mar 21 2012
4 comments
32,328 views