Hi all,
I'm trying to run my JUnit tests in Eclipse, and I'm having some
problems. I'm using maven2 as my build tool, and I have the following
plugin confirmation. I have run the "mvn compile" target, and my source is
then generated into "target/generated-sources/xmlbeans". I then add this to
my source path. When I attempt to parse an xml document with the following
code, I receive this error message. I've added
"target/generated-classes/xmlbeans" to classes output path so that it should
pick up the generated classes, but its not working. Any help would be
greatly appreciated.
Thanks,
Todd
Maven 2 Config:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>xmlbeans</goal>
</goals>
</execution>
</executions>
<inherited>true</inherited>
<configuration>
<schemaDirectory>src/main/xsd</schemaDirectory>
<download>true</download>
</configuration>
</plugin>
Code:
ProfilesDocument doc = null;
try {
doc = ProfilesDocument.Factory.parse(xml);
} catch (XmlException e) {
throw new UrchinException("Unable to parse xml response", e);
}
return doc.getProfiles().getProfileArray();
Exception:
java.lang.ExceptionInInitializerError
at com.onwebconsulting.urchin.profiles.ProfilesDocument$Factory.parse(
ProfilesDocument.java:119)
at com.bnp.insightCommon.dao.rest.UrchinDaoImpl.getProfiles(
UrchinDaoImpl.java:81)
at com.bnp.insightCommon.dao.UrchinDaoTest.getProfiles(
UrchinDaoTest.java:54)
at com.bnp.insightCommon.dao.UrchinDaoTest.testGetProfiles(
UrchinDaoTest.java:41)
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 junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at org.springframework.test.ConditionalTestCase.runBare(
ConditionalTestCase.java:69)
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: java.lang.RuntimeException: Cannot load SchemaTypeSystem. Unable
to load class with name
schemaorg_apache_xmlbeans.system.sD0FCECC1CA81F97745FE1F9A4449F63C.TypeSystemHolder.
Make sure the generated binary files are on the classpath.
at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java
:783)
at com.onwebconsulting.urchin.profiles.ProfilesDocument.<clinit>(
ProfilesDocument.java:20)
... 23 more
Caused by: java.lang.ClassNotFoundException:
schemaorg_apache_xmlbeans.system.sD0FCECC1CA81F97745FE1F9A4449F63C.TypeSystemHolder
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java
:769)
... 24 more