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



'Java' 카테고리의 다른 글

enum equals string  (0) 2012.07.10
Installing Tomcat 6 on CentOS 5  (0) 2012.06.18
Java에서 XML없이 SQL개발하기  (0) 2011.07.01
Fiddler post형식으로 테스트 데이터 보내기  (0) 2011.03.22
split(".")  (0) 2010.08.19

+ Recent posts