aspose file tools*
The moose likes Java in General and the fly likes  JAXBContext - IncompatibleClassChangeError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark " JAXBContext - IncompatibleClassChangeError " Watch " JAXBContext - IncompatibleClassChangeError " New topic
Author

JAXBContext - IncompatibleClassChangeError

sarah Marsh
Ranch Hand

Joined: Mar 06, 2001
Posts: 282
Hello:

Please help! What could be the problem?

I got the running time error for the following code:
JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );

ERROR:
java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:488)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:106)
at com.evermind.naming.ContextClassLoader.defineClass(ContextClassLoader.java:993)
at com.evermind.naming.ContextClassLoader.findClass(ContextClassLoader.java:257)
at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.evermind.server.ApplicationContextClassLoader.findClass(ApplicationContextClassLoader.java:19)
at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at com.sun.xml.bind.ContextFactory_1_0_1.createContext(ContextFactory_1_0_1.java:45)
at java.lang.reflect.Method.invoke(Native Method)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:96)
at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:229)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:149)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:238)

...
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
java.lang.IncompatibleClassChangeError is the superclass of java.lang.InstantiationError amongst others. My guess (and it is a guess) would be that the class "com.acme.foo" doesn't exist. That's looks like a package name anyway, or something you've just left in out of an example (unless you changed it to post).

Hope that helps.

Jules
Mattias Arthursson
Ranch Hand

Joined: Jul 26, 2004
Posts: 90
Wouldn't you get a ClassNotFoundException if the class didn't exist?


Admit nothing. Blame everyone. Be bitter.
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Hmmm, say what you mean Jules! :roll: I mean the class can't be instantiated, i.e. it's an abstract class or interface.

Jules
sarah Marsh
Ranch Hand

Joined: Mar 06, 2001
Posts: 282
Has anybody use JAXB before? The method is as follows, it's
contextPath, not class:

static JAXBContext newInstance(java.lang.String contextPath)
Mattias Arthursson
Ranch Hand

Joined: Jul 26, 2004
Posts: 90
I got a similar error some time ago. In that case it was because I had compiled using a different library than the one I was using when I ran the program.

Looking closer on the error I would think that the class com.acme.foo implements an earlier (or later) version of the desired class.
Mattias Arthursson
Ranch Hand

Joined: Jul 26, 2004
Posts: 90
Originally posted by sarah Marsh:
Has anybody use JAXB before? The method is as follows, it's
contextPath, not class:

static JAXBContext newInstance(java.lang.String contextPath)


Heh, sorry 'bout that. Havent used JAXB; I was guessing based on the error you got. Either way I still think it has something to do with version incompatibility.
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Hi Sarah,

Yes, sorry about the uninformed postings. I feel a sense of responsibility for making a mess of your thread.

Have you read the API doc entry for JAXBContext and the newInstance() method? There are a couple of references in there to jaxb.properties and the javax.xml.bind.context.factory property that might be the root of your problem.

Hope that goes some way towards making amends.

Jules
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JAXBContext - IncompatibleClassChangeError