Java.lang.ClassNotFoundException:net.sf.json.JSONObject

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.