Search code examples
javajsontomcatjson-lib

Java Json parser


I'm using tomcat 5 and JSON parser net/sf/json. I import json-lib2.4-jdk15.jar in my project and add it to `common/endorsed' dir in my tomcat. But when I start my servlet I have this exception:

java.lang.NoClassDefFoundError: net/sf/json/JSONException
net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:108)
net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:84)
com.britecs.atajer.bl.json.SubCategories.getSubCategory(SubCategories.java:37)
com.britecs.atajer.pl.json.SubCategoriesServlet.doGet(SubCategoriesServlet.java:23)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Can someone help me?


Solution

  • I'm not sure 'tomcat/common/endorsed' is the right directory to be using. Have you tried installing your JAR file in tomcat/lib?