高手救命呀
javax.servlet.ServletException: Servlet execution threw an exception
困惑了我一上午。新手才开始学习jsp,求高手救命呀!
错误提示
HTTP Status 500 -
type Exception report
message
description
The server encountered an internal error () that prevented it from fulfilling this request.exception
javax.servlet.
ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError: bean/userBean
test.userservlet.doGet(userservlet.java:15)
test.userservlet.doPost(userservlet.java:40)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.35 logs.
Apache Tomcat/6.0.35
------解决方案--------------------bean/userBean 这个类 没有找到。
------解决方案--------------------你web.xml 文件没有配置好
<servlet-class>web.DerbyServlet</servlet-class>
class的话不能用/ 要用.
bean.userBean
下面是例子:
<web-app id="WebApp_ID">
<display-name>JavaDB</display-name>
<servlet>
<servlet-name>DerbyServlet</servlet-name>
<display-name>DerbyServlet</display-name>
<description></description>
<servlet-class>web.DerbyServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>DeleteServlet</servlet-name>
<display-name>DeleteServlet</display-name>
<description></description>
<servlet-class>web.DeleteServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>InsertServlet</servlet-name>
<display-name>InsertServlet</display-name>
<description></description>
<servlet-class>web.InsertServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DerbyServlet</servlet-name>
<url-pattern>/DerbyServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DeleteServlet</servlet-name>
<url-pattern>/DeleteServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>InsertServlet</servlet-name>
<url-pattern>/InsertServlet</url-pattern>
</servlet-mapping>
</web-app>
------解决方案--------------------java.lang.
NoClassDefFoundError: bean/userBean
你的包没有引入进来。
------解决方案--------------------
如果是新手刚开始学的话,我编码也才一年,但是能懂点,主要是理解项目是如何运行的,是至关重要的,项目的入口都是web.xml,然后再去找对应的servlet或者jsp,然后在jsp里可以写一些连接逻辑层的接口,再然后跳到那个action里,然后可以再那里再去调用一下数据库什么的,最后还可以以return 结束,跳到相应的界面
------解决方案--------------------java.lang.NoClassDefFoundError: bean/userBean 这个没有,
导致userservlet的DoGet和DoPost有问题,仔细看看。
我的异常网推荐解决方案:Servlet.service() for servlet default threw exception,http://www.aiyiweb.com/eclipse/181756.html
我的异常网推荐解决方案:
Eclipse 如何安装eclipseme.feature_1.7.9_site.zip