服务器上传JSON数据[Servlet execution threw an exception]错误
来源:互联网 发布:重庆网络问政平台官网 编辑:程序博客网 时间:2024/05/16 04:38
最近在学Java后台服务器开发,我建立的一个servlet类,要将json数据传到客户端,准备先在网页上输入网址试一下,但是也遇到了一个问题,会报这个错误
Servlet.service() for servlet [com.pjj.test.web.servlet.JsonTestServlet] in context with path [/ServletTest1] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: net.sf.json.JSONObject
net.sf.json.JSONObject找不到,但是我已经在工程里放了相关jar包,如果建立一个test类来获取json是可以的,但是在浏览器就不可以,查了许多资料,逐渐有了些眉目,原因是我只是把相关jar包放到了Referenced Libraries,没有在WebContent中的WEB-INF/lib中放jar包,我认为应该是工程要想用tomcat在网页上获取数据,就会去WEB-INF找相关包,但是WEB-INF中没有JSONObject使用的包,所以出错。解决办法就是:在WEB-INF/lib中加入工程所需要的jar包,我这里的话,是加上JSONObject所需要的一堆jar包。
我只是一只java web小白,这种问题好像是太简单了哈。。。。就当简单记录一下这个问题吧
2 0
- 服务器上传JSON数据[Servlet execution threw an exception]错误
- Servlet execution threw an exception
- MyEclipse错误:Servlet execution threw an exception with root cause
- javax.servlet.ServletException: Servlet execution threw an exception
- javax.servlet.ServletException: Servlet execution threw an exception
- javax.servlet.ServletException: Servlet execution threw an exception
- javax.servlet.ServletException: Filter execution threw an exception
- javax.servlet.ServletException: Filter execution threw an exception
- idea报错servlet execution threw an exception
- 错误Set connectionId threw an exception
- Servlet.service() for servlet jsp threw exception错误
- 错误Servlet.service() for servlet dispatcherServlet threw exception
- Service threw an exception during method invocation: null错误
- libc++abi.dylib: terminate_handler unexpectedly threw an exception错误解决方案
- libc++abi.dylib: terminate_handler unexpectedly threw an exception错误小结
- libc++abi.dylib: terminate_handler unexpectedly threw an exception错误
- libc++abi.dylib: terminate_handler unexpectedly threw an exception错误小结
- libc++abi.dylib: terminate_handler unexpectedly threw an exception错误小结
- 小象学院hadoop进阶
- rails view简单学习
- SqlHelper详细讲解
- cookie实现最近浏览商品
- JS基础--简单图片切换
- 服务器上传JSON数据[Servlet execution threw an exception]错误
- C++ 工具
- Mac系统下搭建lua
- Linux--父子进程同步协作
- 红黑树详解
- ionic2 一.基础 (5)项目app开发开始准备工作
- 在play framework 1.x中使用多线程调用JPA对象
- 华为机试-字符串合并
- JAVA 保留两位小数的四种方法