当前位置: 代码迷 >> Java Web开发 >> 呀javax.servlet.ServletException: Servlet execution threw an exception
  详细解决方案

呀javax.servlet.ServletException: Servlet execution threw an exception

热度:5185   发布时间:2013-02-25 21:14:43.0
高手救命呀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有问题,仔细看看。
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!
 
  • 最近登录:Mon Dec 10 17:47:03 CST 2018
  • 最近登录:Mon Dec 10 17:47:03 CST 2018
  • 最近登录:Mon Dec 10 17:47:03 CST 2018
  • 最近登录:Mon Dec 10 17:47:03 CST 2018
  • 最近登录:Mon Dec 10 17:47:03 CST 2018