Hello all,
I have a perplexing problem. I am using CXFDosgi 1.4 ( 2.7.2 ) and Java
1.7.0_21.
I have a Junit test that contains the following code in the setUp() method:
@Before
public void setUp() {
baseUrl = System.getProperty("envoy-base-url");
factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(ElpManagementService.class);
factory.setAddress(baseUrl + "elpManagement");
emsClient = (ElpManagementService) factory.create();
factory.setServiceClass(UnitDataService.class);
factory.setAddress(baseUrl + "unitData");
udsClient = (UnitDataService) factory.create();
sessionPropertiesHolder = new Holder<String>();
try {
emsClient.startSession(sessionPropertiesHolder);
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
When running from Eclipse ( select unit test, Debug As, Junit Test ), my
test connects to the remote and processes fine. My Test passes. No Problems.
When I run my test from maven ( I am using Tycho Surefire Plugin
integration-test goal), my test does not run and contains the following
failure ( cause highlighted in bold ):
org.apache.cxf.service.factory.ServiceConstructionException
at
org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:332)
at
org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:475)
at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:690)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:537)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:249)
at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:205)
at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
at
org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
at
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:156)
at
org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:156)
at
org.syntech.envoy.dod.services.integration.test.unit.TestUnitTransactionData.setUp(TestUnitTransactionData.java:42)
at junit.framework.TestCase.runBare(TestCase.java:139)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
at
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:123)
at
org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:85)
at
org.eclipse.tycho.surefire.osgibooter.HeadlessTestApplication.run(HeadlessTestApplication.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
*Caused by: javax.xml.bind.JAXBException
- with linked exception:
[javax.xml.bind.JAXBException: property
"com.sun.xml.bind.defaultNamespaceRemap" is not supported]*
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:237)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:396)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618)
at
org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:267)
at
org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:265)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.cxf.common.jaxb.JAXBContextCache.createContext(JAXBContextCache.java:265)
at
org.apache.cxf.common.jaxb.JAXBContextCache.getCachedContextAndSchemas(JAXBContextCache.java:172)
at
org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:464)
at
org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:330)
I run my Junit test from the pde while passing -verbose:class to the JVM and
I can see entries like the following:
[Loaded javax.xml.bind.JAXBContext from C:\Program
Files\Java\jdk1.7.0_21\jre\lib\rt.jar]
When I run the test through maven, using the -verbose:class command I do not
see javax.xml.bind being loaded anywhere. I do see entries from classes
being loaded from my jre, just not these.
Does anyone have any advice with classloading, Maven, and Jaxb?
--
View this message in context:
http://cxf.547215.n5.nabble.com/CXFDOSGI-1-4-Jaxb-Classloader-issue-tp5739840.html
Sent from the cxf-user mailing list archive at Nabble.com.