tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: Jaxb 2.1 API
Date Wed, 04 Jun 2008 01:24:08 GMT

On Jun 3, 2008, at 2:40 PM, Jonathan Gallimore wrote:

> Hi,
>
> I managed to set up a test which reproduced this. I found a couple  
> of ways around the problem:

Thanks, Jonathan!

> One way was to use JDK 1.6 (I could only reproduce your error with  
> 1.5, but maybe that's just my machine...)

Also note, that JDK 1.6 is faster *and* you don't need the javaagent  
(yay!).  Not having the javaagent is certainly a nice thing all by  
itself.

> The other way was to remove javaee-api-5.0.1 from my classpath, and  
> replace it with the various Java EE spec jars from Geronimo.  
> Specifically I had to use the following:
>
> axis2-jaxws-api-1.3
> geronimo-activation_1.1_spec
> geronimo-annotation_1.0_spec
> geronimo-ejb_3.0_spec
> geronimo-interceptor_3.0_spec
> geronimo-j2ee-connector_1.5_spec
> geronimo-jacc_1.1_spec
> geronimo-jms_1.1_spec
> geronimo-jpa_3.0_spec
> geronimo-jta_1.1_spec
> geronimo-stax-api_1.0_spec
> geronimo-ws-metadata_2.0_spec
> jaxb-api-2.1.3

That's exactly right.

> This feels pretty nasty to me though, I'm not sure I really  
> recommend it. I don't know what your production environment is, but  
> I  definitely wouldn't start swapping out jars in a standalone  
> OpenEJB server/ OpenEJB-Tomcat / Geronimo setup (and I guess if  
> you're using the standalone server or the Tomcat plugin you might  
> run into the same issue when you deploy your app).

I think it's a fine suggestion, swapping out jars in OpenEJB or  
OpenEJB + Tomcat isn't such a big issue.  In fact we shipped with all  
those individual jars in 3.0-beta-1 but it was just a lot to look at  
and a lot to deal with in your IDE or build system so we compacted  
them down to one jar.

> I'm happy to look at doing some work on the OpenEJB javaee-api jar,  
> or on the server itself to try and come up with a more elegant  
> solution, but I think it would need a sanity check from one of the  
> other developers first (any thoughts, anyone?).

We should definitely document this at the least.  We could add a page  
just for this "Jaxb 1.1" topic and the workarounds you point out.  If  
we start getting a lot of hits on it, we could look at other options.   
Maybe rolling up a second javaee-api jar of some kind that doesn't  
include jaxb (might have been a bad idea to include it).  Maybe even a  
tool on the website that allows people to click a few checkboxes and  
get all the apis and versions they want (could work).

-David


> Amah Ahite wrote:
>> 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
>>
>>
>>
>>
>>
>>
>>
>>
>


Mime
View raw message