Skip to main content

Running JAXB 1.0 application with JAXB 2.1.2 Libs failed

1 reply [Last post]
dehlinger
Offline
Joined: 2007-04-27
Points: 0

Hello JAXB Developers and Users,

I'd like to run my old JAXB 1.x applications on the JAXB 2.0 runtime.
The applications are using the default context implementation class: com.sun.tools.xjc.runtime.DefaultJAXBContextImpl defined in the jaxb.properties.
Running this applications using the jaxb 2.1.12 jars including the jaxb1-impl.jar an ClassNotFoundException will be thrown.
The DefaultJAXBContextImpl is not in the classpath.
Does anybody knows a solution to run my old JAXB1.x applications side by side with my JAXB 2.x applications?

Thanks in advance.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ssso
Offline
Joined: 2006-01-27
Points: 0

Hi all,

I have the same problem.

I have existing jaxb 1.0 classes (generated by 1.0 xjc).

Try to run them with a standalone program (no appserver) or junit 4.

Got this exception:

com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions

com.sun.xml.bind.DefaultJAXBContextImpl does not have a no-arg default constructor.

this problem is related to the following location:

at com.sun.xml.bind.DefaultJAXBContextImpl

at com.mamama.apple.ObjectFactory

at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91)

at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:436)

at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:277)

at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1100)

at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:143)

at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:110)

at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:191)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:128)

at javax.xml.bind.ContextFinder.find(ContextFinder.java:290)

at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)

at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)

at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:244)

at com.mamama.api.client.RestTemplate.getForObject(RestTemplate.java:33)

at com.mamama.api.client.RestTemplate.main(RestTemplate.java:21)

Convention wisdom is just to put jaxb1-impl.jar into the classpath. Doesn't work.

Somehow weblogic does not have the same complain. Couldn't figure out how weblogic do it. But I want my junit environment working first...

Any hints would be appreciated.
Simon