databinding-jaxb requires explicit dependency on jaxb-impl
----------------------------------------------------------
Key: TUSCANY-3725
URL: https://issues.apache.org/jira/browse/TUSCANY-3725
Project: Tuscany
Issue Type: Bug
Reporter: ant elder
Fix For: Java-SCA-2.0-Beta1
The module databinding-jaxb requires explicit dependency on jaxb-impl which it
shouldn't as thats part of the Java 6 base. You can see the problem if you
remove the jaxb dependency:
C:\Tuscany\SVN\trunk\modules\databinding-jaxb>svn diff
Index: pom.xml
===================================================================
--- pom.xml (revision 1022443)
+++ pom.xml (working copy)
@@ -62,13 +62,6 @@
<version>1.0.1</version>
</dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>2.1.12</version>
- <scope>runtime</scope>
- </dependency>
-
</dependencies>
<repositories>
and then build the module the tests fail with:
[java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
at
org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.getDefaultJAXBContext(JAXBContextCache.java:157)
at
org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.<init>(JAXBContextCache.java:122)
at
org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.<init>(JAXBContextCache.java:114)
at
org.apache.tuscany.sca.databinding.jaxb.JAXBContextCacheTestCase.testCache(JAXBContextCacheTestCase.java:46)
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
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
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
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:187)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:376)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
at
org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache$1.run(JAXBContextCache.java:138)
at
org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache$1.run(JAXBContextCache.java:127)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.newJAXBContext(JAXBContextCache.java:127)
at
org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.getDefaultJAXBContext(JAXBContextCache.java:155)
... 29 more
Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory
at
org.apache.tuscany.sca.extensibility.impl.ClassLoaderDelegate.findClass(ClassLoaderDelegate.java:62)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at javax.xml.bind.ContextFinder.safeLoadClass(ContextFinder.java:481)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:185)
... 37 more
The tests will still run fine when run within Eclipse, and also if the surefire
plugin is changed to have fork mode of never:
C:\Tuscany\SVN\trunk\modules\databinding-jaxb>svn diff
Index: pom.xml
===================================================================
--- pom.xml (revision 1022443)
+++ pom.xml (working copy)
@@ -62,13 +62,6 @@
<version>1.0.1</version>
</dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>2.1.12</version>
- <scope>runtime</scope>
- </dependency>
-
</dependencies>
<repositories>
@@ -169,6 +162,15 @@
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <forkMode>never</forkMode>
+ </configuration>
+ </plugin>
+
</plugins>
</build>
so this is something funny with the way the JAXB ContextFactory is being found
or loaded by Tuscany, you can see from the above stacktrace that the root of
the problem is from:
Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory
at
org.apache.tuscany.sca.extensibility.impl.ClassLoaderDelegate.findClass(ClassLoaderDelegate.java:62)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.