I have written Unit tests for android using Junit, Mockito, PowerMock and Robolectric and used Robolectric Test Runner for running these tests in Linux environment through command line.
I want to generate the coverage report using Emma command line.
I am facing the below error.
1) initializationError(com.ex.test.1_UT)
org.junit.runners.model.InitializationError
at org.junit.runners.ParentRunner.validate(ParentRunner.java:346)
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:74)
at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:55)
at org.robolectric.RobolectricTestRunner.<init>(RobolectricTestRunner.java:84)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runner.Computer.getRunner(Computer.java:38)
at org.junit.runner.Computer$1.runnerForClass(Computer.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:98)
at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:84)
at org.junit.runners.Suite.<init>(Suite.java:79)
at org.junit.runner.Computer.getSuite(Computer.java:26)
at org.junit.runner.Request.classes(Request.java:69)
at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
at org.junit.runner.JUnitCore.runMain(JUnitCore.java:98)
at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:53)
at org.junit.runner.JUnitCore.main(JUnitCore.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
t java.lang.reflect.Method.invoke(Method.java:606)
at com.vladium.emma.rt.AppRunner$Invoker.run(AppRunner.java:655)
at java.lang.Thread.run(Thread.java:745)
FAILURES!!!
Tests run: 1, Failures: 1
Please some one help me with this. Thanks
The initialisation error that comes with Robolectric can be solved with the annotation org.robolectric.annotation.internal.DoNotInstrument on your test class. Like:
#RunWith(RobolectricTestRunner.class)
#Config(constants = BuildConfig.class)
#DoNotInstrument
public class MyActivityTest {
..
}
Related
When I tried to build my app I receive this error:
C:\bt\IOS_Catedral\build.xml:92: Compile failed; see the compiler error output for details.
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1180)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:935)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.Main.start(Main.java:198)
at org.apache.tools.ant.Main.main(Main.java:286)
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 com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:30)
Ant build completed with 4 errors and one warning in 2s at 23/01/2016 10:59 AM
This was re4ceived building for IOS from an W7 PC, similar errors was received for Android and Windows Phone.
How can I build an app?
The errors should be listed above/below those lines, you only posted some of the output. If you scroll up/down there you will see the full error log.
I'm using Jetty as an embedded web server within OSGi and spring-dm environment. All my bundles and war files are deployed successfully. However I'm observing the following warning in my logs:
2015-03-25 17:32:13.748:WARN:oejw.StandardDescriptorProcessor:Could not instantiate listener org.eclipse.jetty.servlet.listener.IntrospectorCleaner
java.lang.ClassNotFoundException: org.eclipse.jetty.servlet.listener.IntrospectorCleaner
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:789)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.eclipse.jetty.server.handler.ContextHandler.loadClass(ContextHandler.java:1517)
at org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitListener(StandardDescriptorProcessor.java:1863)
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:606)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:85)
at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:72)
at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:366)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:710)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.springframework.osgi.web.deployer.jetty.JettyWarDeployer.startWebAppContext(JettyWarDeployer.java:218)
at org.springframework.osgi.web.deployer.jetty.JettyWarDeployer.startDeployment(JettyWarDeployer.java:123)
at org.springframework.osgi.web.deployer.support.AbstractWarDeployer.deploy(AbstractWarDeployer.java:93)
at org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$DeployTask.doRun(WarLoaderListener.java:261)
at org.springframework.osgi.web.extender.internal.activator.WarLoaderListener$DeploymentManager$BaseTask.run(WarLoaderListener.java:219)
at org.springframework.scheduling.timer.DelegatingTimerTask.run(DelegatingTimerTask.java:70)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Though this warning is not impacting any functionality, i'm still curious to know why this error is happening. With little debugging I can see that the package "org.eclipse.jetty.servlet.listener" is not imported by any of the modules. I explicitly added this import to jetty-webapp and spring-osgi-web bundles, but that didn't help either.
Upgrade your version of Jetty, you have a very old version with a faulty manifest.
This was fixed well over a year ago.
$ cd jetty-distribution-9.2.10.v20150310
$ jar -xvf lib/jetty-servlet-9.2.10.v20150310.jar META-INF/MANIFEST.MF
inflated: META-INF/MANIFEST.MF
$ grep -A3 Export-Package META-INF/MANIFEST.MF
Export-Package: org.eclipse.jetty.servlet;version="9.2.10",org.eclipse
.jetty.servlet.jmx;version="9.2.10",org.eclipse.jetty.servlet.listene
r;version="9.2.10"
Bundle-Classpath: .
I have a build on TeamCity that runs unit tests via Gradle. Intermitentlly, tests that involve fragments or activities fail with a ClassNotFoundException for classes like android.support.v4.app.FragmentTransitionCompat21$ViewRetriever or android.support.v4.app.ActivityCompat21$SharedElementCallback21. The tests fail when starting the fragment, and I've tried all of the methods to start a fragment from this question - How can I test fragments with Robolectric?.
Here's an example for a test:
#Test
public void ContactSupportFragment_CallBtnClicked_CallWasMade() throws Exception
{
ContactSupportFragment fragment = new ContactSupportFragment();
startFragment(fragment);
LinearLayout btnCall = (LinearLayout) fragment.getView().findViewById(R.id.contact_support_call_btn);
btnCall.performClick();
Mockito.verify(techSupportCall, Mockito.times(1)).call(Mockito.any(Context.class),
Mockito.eq(Robolectric.application.getString(R.string.tech_support_phone_number)));
}
Here's an example for a stack trace:
java.lang.NoClassDefFoundError: android/support/v4/app/FragmentTransitionCompat21$ViewRetriever
at android.support.v4.app.FragmentManagerImpl.beginTransaction(FragmentManager.java:481)
at org.robolectric.util.FragmentTestUtil.startFragment(FragmentTestUtil.java:25)
at com.asurion.solutohome.callsupport.ContactSupportFragmentTest.ContactSupportFragment_CallBtnClicked_CallWasMade(ContactSupportFragmentTest.java:70)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:236)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:158)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:360)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: android.support.v4.app.FragmentTransitionCompat21$ViewRetriever
at org.robolectric.bytecode.AsmInstrumentingClassLoader.loadClass(AsmInstrumentingClassLoader.java:88)
at android.support.v4.app.FragmentManagerImpl.$$robo$$FragmentManagerImpl_917e_beginTransaction(FragmentManager.java:481)
at android.support.v4.app.FragmentManagerImpl.beginTransaction(FragmentManager.java)
at org.robolectric.util.FragmentTestUtil.startFragment(FragmentTestUtil.java:25)
at com.asurion.solutohome.callsupport.ContactSupportFragmentTest.ContactSupportFragment_CallBtnClicked_CallWasMade(ContactSupportFragmentTest.java:70)
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:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:236)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:158)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
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:606)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
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:606)
It hasn't happened locally yet, only on the TeamCity agent, however I haven't found anything different between my machine and the agent (same SDK, same Gradle build etc.).
What can cause these exceptions?
So following #EugenMartynov's suggestion I added an additional assemble build step to my Teamcity build before building running the tests and so far all the builds pass. It seems that Robolectric indeed has some issues with CI builds.
So to summarize, instead of building once and running tests, my build runs:
clean and build
build again and run tests
All of the tests pass every build.
I am not much into the topic of Robolectric, but the stacktrace you sent looks like you forgot to add the binaries or the jar, which includes the class android.support.v4.app.FragmentTransitionCompat21 (i think this class is included in the android SDK), to your classpath.
As per #Fastas answer. You can run
gradle test
This will resolve the issue, but as for it's exact cause, it is as of yet unknown.
For my own part, I think this is related to dependencies from my app project not fully resolving the first build of an exterior app-test project. I am using the following code in app-test/build.gradle.
dependencies {
// other dependencies ...
compile project(':app')
testCompile androidModule.android.applicationVariants.toList().first().javaCompile.classpath
testCompile androidModule.android.applicationVariants.toList().first().javaCompile.outputs.files
testCompile files(androidModule.plugins.findPlugin("com.android.application").getBootClasspath())
}
Above, possibly classpath or outputs.files is not fully resolved until the assemble task finishes.
Update: March 23, 2015
Moving my test suite to the experimental test support within the app module resolved this issue for me.
I'm having a painful time resolving a Camel-CXF ClassNotFoundException. I've included a sample program exhibiting the problem
You can find the source code at:
git#bitbucket.org:levonk/camel-cxf-example.git
To run the program after checking out the project run:
mvn test exec:java
Here is the exception stack trace:
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[[From[cxf://http://www.webservicex.net/globalw... because of Failed to resolve endpoint: cxf://http://www.webservicex.net/globalweather.asmx/GetWeather?publishedEndpointUrl=http%3A%2F%2Fwww.webservicex.net%2Fglobalweather.asmx&serviceClass=net.webservicex.GlobalWeather.class due to: net.webservicex.GlobalWeather.class
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:181)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:750)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1829)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1609)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1478)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1446)
at org.apache.camel.main.Main.doStart(Main.java:109)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.main.MainSupport.run(MainSupport.java:148)
at org.apache.camel.main.MainSupport.run(MainSupport.java:343)
at com.levonk.app.example.camel.MainApp.main(MainApp.java:17)
... 6 more
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: cxf://http://www.webservicex.net/globalweather.asmx/GetWeather?publishedEndpointUrl=http%3A%2F%2Fwww.webservicex.net%2Fglobalweather.asmx&serviceClass=net.webservicex.GlobalWeather.class due to: net.webservicex.GlobalWeather.class
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:508)
at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:62)
at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:191)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:108)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:114)
at org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
at org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:90)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:861)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:176)
... 17 more
Caused by: java.lang.ClassNotFoundException: net.webservicex.GlobalWeather.class
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at org.apache.cxf.common.classloader.ClassLoaderUtils.loadClass2(ClassLoaderUtils.java:287)
at org.apache.cxf.common.classloader.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:261)
at org.apache.camel.component.cxf.CxfEndpoint.setServiceClass(CxfEndpoint.java:653)
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.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:492)
at org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:546)
at org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:434)
at org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:249)
at org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:258)
at org.apache.camel.component.cxf.CxfComponent.createEndpoint(CxfComponent.java:84)
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:119)
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:488)
... 25 more
This is an issue with the maven Exec Maven plugin not picking up the classes generated from your WSDL at runtime.
The correct way to do structure this sort of thing in Maven is to separate your WSDL -> Java generation out into a seperate project, and add a dependency on that project in your cxf-client. This way, the generated code is just a dependency like any other. See https://github.com/FuseByExample/smx-ws-examples for an example of how to do this.
I found pdfbox-1.6.0.jar doesn't work on my system so, I tried to build it from Source and installed Maven.
I got this error while building either on Windows XP or Fedora 15:
Tests run: 8, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.077 sec <<< FAILURE!
testDateList(org.apache.jempbox.xmp.XMPSchemaTest) Time elapsed: 0.007 sec <<< FAILURE!
junit.framework.AssertionFailedError: expected:<19800000> but was:<18060000>
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.Assert.failNotEquals(Assert.java:283)
at junit.framework.Assert.assertEquals(Assert.java:64)
at junit.framework.Assert.assertEquals(Assert.java:195)
at junit.framework.Assert.assertEquals(Assert.java:201)
at org.apache.jempbox.xmp.XMPSchemaTest.assertEquals(XMPSchemaTest.java:249)
at org.apache.jempbox.xmp.XMPSchemaTest.testDateList(XMPSchemaTest.java:312)
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 junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
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)
What is the solution?
This is a known issue in PDFBox, see (PDFBOX-1157). Until the bug is fixed, you can work around the issue by disabling tests during your Maven build, like this:
mvn clean install -DskipTests