users@jaxb.java.net

Re: Loader Constraints and Maven 2

From: Ben Gidley <ben_at_gidley.co.uk>
Date: Thu, 2 Feb 2006 09:57:08 +0000

I think I have fixed this now. It is do with the the class loaders in Maven
2 surefire.

I have sent a patch to the documentation see
http://jira.codehaus.org/browse/MSUREFIRE-57

and see http://www.nabble.com/-m2-Forking-with-Surefire-t1040245.html for
the solution.

Thanks

Ben

On 2/1/06, Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com> wrote:
>
>
> This usually has something to do with a non-standard classloader that
> doesn't follow parent-first classloading semantics.
>
> Usually those classloaders allow you to tweak what to delegate to the
> parent, and that often fixes the problem. If you are desperate enough, I
> suspect putting the QName class into the endorsed directory might help.
>
> Otherwise, some of us have to start debugging Maven2...
>
> Ben Gidley wrote:
> > Hi,
> >
> > I am having an odd issue with Jaxb-impl 2.0 ea 3 within Maven/Junit. My
> code
> > and the test assocated run fine in an IDE but don't in maven. The error
> is a
> > Loader constraints violated. I am completely stumped as to why as I am
> using
> > a forked JVM to remove the normal issues with this sort of thing.
> >
> > Has anyone else seen this (and hopefuly fixed it)!
> >
> > java.lang.LinkageError: loader constraints violated when linking
> > javax/xml/namespace/QName class
> > at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl.<clinit>(
> > RuntimeBuiltinLeafInfoImpl.java:779)
> > at com.sun.xml.bind.v2.model.impl.RuntimeTypeInfoSetImpl.<init>(
> > RuntimeTypeInfoSetImpl.java:25)
> > at
> com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(
> > RuntimeModelBuilder.java:78)
> > at
> com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.createTypeInfoSet(
> > RuntimeModelBuilder.java:41)
> > at com.sun.xml.bind.v2.model.impl.ModelBuilder.<init>(
> ModelBuilder.java:97)
> > at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(
> > RuntimeModelBuilder.java:44)
> > at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(
> > JAXBContextImpl.java:320)
> > at com.sun.xml.bind.v2.runtime.JAXBContextImpl .<init>(
> > JAXBContextImpl.java:198)
> > at com.sun.xml.bind.v2.ContextFactory.createContext(
> ContextFactory.java
> > :76)
> > at com.sun.xml.bind.v2.ContextFactory.createContext(
> ContextFactory.java
> > :55)
> > at com.sun.xml.bind.v2.ContextFactory.createContext (
> ContextFactory.java
> > :124)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> > at sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown Source)
> > at java.lang.reflect.Method.invoke(Unknown Source)
> > at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)
> > at javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
> > at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:358)
> > at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:323)
> > at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:244)
> > at com.anite.tpr.fairport.marshall.v3.impl.V3Marshall.loadXmlFile (
> > V3Marshall.java:36)
> > at
> $IV3Marshall_109267aaccc.loadXmlFile($IV3Marshall_109267aaccc.java)
> > at
> $IV3Marshall_109267aacc9.loadXmlFile($IV3Marshall_109267aacc9.java)
> > at
> $IV3Marshall_109267aacc8.loadXmlFile($IV3Marshall_109267aacc8.java)
> > at com.anite.tpr.fairport.impl.V3OmManagerImplTest.testLoadSavePsr(
> > V3OmManagerImplTest.java:36)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source)
> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > at java.lang.reflect.Method.invoke(Unknown Source)
> > at junit.framework.TestCase.runTest(TestCase.java:154)
> > at junit.framework.TestCase.runBare(TestCase.java:127)
> > 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 sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
> > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > at java.lang.reflect.Method.invoke(Unknown Source)
> > at org.apache.maven.surefire.battery.JUnitBattery.executeJUnit(
> > JUnitBattery.java:242)
> > at org.apache.maven.surefire.battery.JUnitBattery.execute(
> > JUnitBattery.java:216)
> > at org.apache.maven.surefire.Surefire.executeBattery (Surefire.java
> :215)
> > at org.apache.maven.surefire.Surefire.run(Surefire.java:163)
> > at org.apache.maven.surefire.Surefire.run(Surefire.java:87)
> > at org.apache.maven.surefire.Surefire.run(Surefire.java:63)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > at java.lang.reflect.Method.invoke(Unknown Source)
> > at org.apache.maven.surefire.SurefireBooter.main(SurefireBooter.java
> > :728)
> >
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
>