2 oxl9235 oxl9235 于 2017.12.12 19:13 提问

学习hibernate跳转servlet时出现异常,查了资料还是解决不了,求大神帮下忙,谢谢!

控制台文件:
严重: Allocate exception for servlet SaveCustomer
java.lang.ClassNotFoundException: servlet.SaveCustomer
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:142)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:865)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)

浏览器页面:
type Exception report

message Error instantiating servlet class servlet.SaveCustomer

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Error instantiating servlet class servlet.SaveCustomer
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:748)

root cause

java.lang.ClassNotFoundException: servlet.SaveCustomer
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:748)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.
Apache Tomcat/7.0.47

4个回答

yujiaao
yujiaao   2017.12.12 19:40
已采纳

servlet.SaveCustomer类找不到
1·核对名称是否正确
2·检查是否正确编译发布到项目目录下,project/WEB-INF/classes

oxl9235
oxl9235 回复COCO_AS: 已找资料,现已解决问题。十分感谢您的指导!
大约一个月之前 回复
yujiaao
yujiaao 这可一言难尽啊,要看你是项目配置文件和项目目录树是什么?
大约一个月之前 回复
oxl9235
oxl9235 请问没有编译发布到项目目录下,project/WEB-INF/classes,是什么原因呢?怎么解决,还请大神指导,谢谢!
大约一个月之前 回复
sinat_21843047
sinat_21843047   2017.12.13 16:28

java.lang.ClassNotFoundException: servlet.SaveCustomer
类找不到异常 ,后面接的是找不到的类

u014042623
u014042623   2017.12.12 20:19

你检查一下你的web.xml里有没有配置servlet,


Servlet的名称(自己起的,不要重复)

Servlet的类路径(xx.xx.xx.xxservlet)





Servlet的名称(与上面的一样)

/url名字(自己起的,不要重复,注意/,不能丢)

u014042623
u014042623   2017.12.12 20:20
 <servlet>  
    <servlet-name>Servlet的名称(自己起的,不要重复)</servlet-name>  
    <servlet-class>Servlet的类路径(xx.xx.xx.xxservlet)</servlet-class>  
</servlet>  
<servlet-mapping>  
    <servlet-name>Servlet的名称(与上面的一样)</servlet-name>  
    <url-pattern>/url名字(自己起的,不要重复,注意/,不能丢)</url-pattern>  
</servlet-mapping>    
oxl9235
oxl9235 谢谢您的意见,但是我的问题不是配置文件的原因。
大约一个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!