Hi,
I am using openejb to test a code that use jaxb-impl-2.1.3.jar which
requires Jaxb 2.1 API.
The openejb javaee-api.jar, that seems to be loaded first by the
classloader, contains Jaxb API 2.0 and make my test failed.
I noticed that Jaxb 2.0 is the one required by Java EE specs but I
would
like to known whether there is a simple way to override this in
OpenEJB?
Thanks in advance
The exception is:
javax.naming.NamingException: Attempted to load OpenEJB. OpenEJB has
encountered a fatal error and cannot be started: The Assembler
encountered
an unexpected error while attempting to build the container
system.: JAXB
2.0 API jar is being loaded (from
jar:file:/C:/repo/org/apache/openejb/javaee-api/5.0-1/javaee-
api-5.0-1.jar!/javax/xml/bind/annotation/XmlSchema.class),
but this RI (from
jar:file:/C:/repo/com/sun/xml/bind/jaxb-impl/2.1.3/jaxb-
impl-2.1.3.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class)
requires JAXB 2.1 API jar. [Root exception is
org.apache.openejb.OpenEJBException: OpenEJB has encountered a
fatal error
and cannot be started: The Assembler encountered an unexpected
error while
attempting to build the container system.: JAXB 2.0 API jar is
being loaded
(from
jar:file:/C:/repo/org/apache/openejb/javaee-api/5.0-1/javaee-
api-5.0-1.jar!/javax/xml/bind/annotation/XmlSchema.class),
but this RI (from
jar:file:/C:/repo/com/sun/xml/bind/jaxb-impl/2.1.3/jaxb-
impl-2.1.3.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class)
requires JAXB 2.1 API jar.]
at
org
.apache
.openejb
.client
.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
at
org
.apache
.openejb
.client
.LocalInitialContextFactory
.getInitialContext(LocalInitialContextFactory.java:40)
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:
667)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:
247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at
posttrade
.rbk
.service
.distributor
.mediator.xontro.ctrl.CommandTest.setUp(CommandTest.java:18)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org
.eclipse
.jdt
.internal
.junit
.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at
org
.eclipse
.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org
.eclipse
.jdt
.internal
.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org
.eclipse
.jdt
.internal
.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
386)
at
org
.eclipse
.jdt
.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
196)
Caused by: org.apache.openejb.OpenEJBException: OpenEJB has
encountered a
fatal error and cannot be started: The Assembler encountered an
unexpected
error while attempting to build the container system.: JAXB 2.0 API
jar is
being loaded (from
jar:file:/C:/repo/org/apache/openejb/javaee-api/5.0-1/javaee-
api-5.0-1.jar!/javax/xml/bind/annotation/XmlSchema.class),
but this RI (from
jar:file:/C:/repo/com/sun/xml/bind/jaxb-impl/2.1.3/jaxb-
impl-2.1.3.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class)
requires JAXB 2.1 API jar.
at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:156)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:288)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:267)
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:585)
at
org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:
36)
at
org
.apache
.openejb
.client
.LocalInitialContextFactory.init(LocalInitialContextFactory.java:62)
at
org
.apache
.openejb
.client
.LocalInitialContextFactory.init(LocalInitialContextFactory.java:51)
... 19 more
Caused by: java.lang.LinkageError: JAXB 2.0 API jar is being loaded
(from
jar:file:/C:/repo/org/apache/openejb/javaee-api/5.0-1/javaee-
api-5.0-1.jar!/javax/xml/bind/annotation/XmlSchema.class),
but this RI (from
jar:file:/C:/repo/com/sun/xml/bind/jaxb-impl/2.1.3/jaxb-
impl-2.1.3.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class)
requires JAXB 2.1 API jar.
at
com
.sun.xml.bind.v2.model.impl.ModelBuilder.<clinit>(ModelBuilder.java:
136)
at
com
.sun
.xml
.bind
.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:406)
at
com
.sun
.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:270)
at
com
.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:
103)
at
com
.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:81)
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:585)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:368)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
at
org
.apache.openejb.config.sys.JaxbOpenejb.getContext(JaxbOpenejb.java:
295)
at
org
.apache.openejb.config.sys.JaxbOpenejb.unmarshal(JaxbOpenejb.java:
310)
at
org
.apache.openejb.config.sys.JaxbOpenejb.readConfig(JaxbOpenejb.java:
216)
at
org
.apache
.openejb
.config
.ConfigurationFactory
.getOpenEjbConfiguration(ConfigurationFactory.java:253)
at
org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:
249)
at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:149)
... 28 more