Check the dependency package first.
Packages that need to be imported using Net.sf.json
If the jar files are present.
Right-click Project selection Build Path
In Develoyment Assembly
Add Maven Dependencies
User Answer 1:
I have imported the JSON jar package and its required dependency package, the process is: Right-click Project selection Build path–> config build Path–>add extenal jar to add the required jar above. At this point, it is found that the code written in the servlet about Jsonobject does not make an error, and then runs the program, which occurs when the code running to the JSON object java.lang.noclassdeffounderror:net/sf/json/ Jsonobject abnormal, lying trough!! I have already imported the jar package?? Don't you see the code Editor I wrote was not reported as abnormal?? Why throw a Noclassdeffounderror exception when running?
WORKAROUND: Open the Tomcat folder associated with Eclipse, copy the required jar packages into the Lib folder, and restart the project, the problem is fixed.
Java.lang.ClassNotFoundException:net.sf.json.JSONObject