XStream noclassdeffound error

Posted by Jimmy on Stack Overflow See other posts from Stack Overflow or by Jimmy
Published on 2012-11-19T04:54:09Z Indexed on 2012/11/19 5:00 UTC
Read the original article Hit count: 133

Filed under:
|

I am attempting to run Xstream in a netbeans proof of concept project. I have the following code.

XStream xstream = new XStream();
FileOutputStream fis = new FileOutputStream("Test.xml");
xstream.toXML(company, fis);

The program is crashing on the first line of code with the following error.

Exception in thread "main" java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserException
    at com.thoughtworks.xstream.XStream.<init>(XStream.java:336)
    at Parser.XParser.Parse(XParser.java:24)
    at rejaxbtest.REJAXBTest.main(REJAXBTest.java:39)
Caused by: java.lang.ClassNotFoundException: org.xmlpull.v1.XmlPullParserException
    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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 3 more
Java Result: 1

I have seen one other thread with this problem, but the answer that was given was put the jar in the project lib directory, but netbeans has already correctly finished that task. Any other possible thing that would cause java not to recognize the Xstream class at runtime even though it is fine at compile time?

Thanks

Jimmy

© Stack Overflow or respective owner

Related posts about java

Related posts about xstream