You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Todd Nine <to...@gmail.com> on 2008/02/07 23:54:33 UTC
Help with running in eclipse
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
Re: Help with running in eclipse
Posted by Todd Nine <to...@gmail.com>.
Thanks for the help David. Unfortunately I tried the eclipse:eclipse, and
it didn't fix my issue. I notice something earlier about producting a test
jar I could add to my class path, but now I can't find it. Do you have any
info on this?
Thanks,
Todd
On Feb 8, 2008 3:58 AM, David Jencks <da...@yahoo.com> wrote:
> IIUC the maven build works fine, its just running the unit tests in
> eclipse that doesn't work?
>
> I don't use eclipse but running tests in IDEA works fine with
> generated IDEA project files using mvn idea:idea. Have you tried mvn
> eclipse:clean eclipse:eclipse and compared with what you have now?
> It's not too easy to tell but it looks to me that mvn idea:idea
> generates something similar to what you have, so I'm a bit mystified.
>
> thanks
> david jencks
>
> On Feb 7, 2008, at 2:54 PM, Todd Nine wrote:
>
> > 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.Typ
> > eSystemHolder. 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.Typ
> > eSystemHolder
> > 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
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
Re: Help with running in eclipse
Posted by David Jencks <da...@yahoo.com>.
IIUC the maven build works fine, its just running the unit tests in
eclipse that doesn't work?
I don't use eclipse but running tests in IDEA works fine with
generated IDEA project files using mvn idea:idea. Have you tried mvn
eclipse:clean eclipse:eclipse and compared with what you have now?
It's not too easy to tell but it looks to me that mvn idea:idea
generates something similar to what you have, so I'm a bit mystified.
thanks
david jencks
On Feb 7, 2008, at 2:54 PM, Todd Nine wrote:
> 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.Typ
> eSystemHolder. 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.Typ
> eSystemHolder
> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org