File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes LinkageError while defining class: javax.xml.namespace.QName Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "LinkageError while defining class: javax.xml.namespace.QName" Watch "LinkageError while defining class: javax.xml.namespace.QName" New topic

LinkageError while defining class: javax.xml.namespace.QName

Gangadhara Rao

Joined: Jun 02, 2007
Posts: 7
Hello All,

I am getting an exception i.e... Exception thrown : java.lang.LinkageError: LinkageError while defining class: javax.xml.namespace.QName.

I am using jaxb JWSDP 1.4, the jar files which I am using are::jaxb-libs.jar

My jaxb is working very much fine. Now the problem is I have a webservice to be consumed.I have generated client components using, RSA6.0.1.1 and in a webproject which uses servlet version 2.3 .

Many of the client component classes use javax.xml.namespace.QName and I found this class name in these jar files.

When I am instatiating my proxy class to consume webservcie I am getting the following exception , I am just giving the trace..

Exception thrown : java.lang.LinkageError: LinkageError while defining class: javax.xml.namespace.QName
Could not be defined due to: Class javax/xml/namespace/QName violates loader constraints: parent and child already loaded different classes
This is often caused by having a class defined at multiple
locations within the classloader hierarchy. Other potential causes
include compiling against an older or newer version of the class
that has an incompatible method signature.
Dumping the current context classloader hierarchy:
==> indicates defining classloader

WebSphere_PortalV5.1 Run time does contain, the jar files which has this QName class .

Please guide me as to how this problem can be resolved .

Thanks in advance..
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15081

Have you looked up LinkageError in the Java API documentation? The description of it says:

Subclasses of LinkageError indicate that a class has some dependency on another class; however, the latter class has incompatibly changed after the compilation of the former class.

It looks like you are mixing different versions of Java, or different versions of an XML parser. Are you compiling and running on a Sun JRE or on an IBM JRE? Check which XML parser you are using and if it conflicts with something else in your system. This can be complicated to find out, so you'll have to watch very carefully...

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: LinkageError while defining class: javax.xml.namespace.QName
jQuery in Action, 3rd edition