Java

java.lang.NoClassDefFoundError: org/codehaus/jettison/mapped/Configuration

gilnet 2012. 6. 12. 19:00

Consider a simple Xsctream example to create JSON out of the Bean:

Bean bean = new Bean();
bean
.addNames("John", "Doe");
bean
.addNames("Jane", "Doe");

XStream xstream = new XStream(new JettisonMappedXmlDriver());    
xstream
.setMode(XStream.NO_REFERENCES);

System.out.println(xstream.toXML(bean));

results in

Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/jettison/mapped/Configuration
    at com
.thoughtworks.xstream.io.json.JettisonMappedXmlDriver.<init>(JettisonMappedXmlDriver.java:55)
    at
Main.main(Main.java:12)

Note that libraries are imported as they should be

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;

And proper jars are included

enter image description here

link|improve this question

feedback
  
 

2
down voteaccepted

You need jettison.jar from codehaus click this link