日期:2014-05-17  浏览次数:20904 次

servlet入门示例出错,提示"Error instantiating servlet class"
大家好!我初学java的web开发,有些很基础的问题弄不通,还请大家指点。
我正在学servlet,在做一个入门示例时,就是访问不了正常的页面。不知道应该怎么解决这个问题。具体如下:
我是按这个页面:http://blog.csdn.net/wangdingqiaoit/article/details/7674367 来搭建环境了。我用的是myeclipse10, tomcat 7, jdk1.7。访问http://localhost:8080/FirstServlet/index.jsp文件没有问题,但访问http://localhost:8080/FirstServlet/servlet/Test这个页面时,提示:HTTP Status 500 - Error instantiating servlet class test.Test

具体错误为:
type Exception report
message Error instantiating servlet class test.Test
description The server encountered an internal error that prevented it from fulfilling this request.
exception 
javax.servlet.ServletException: Error instantiating servlet class test.Test
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.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:243
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:241 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) java.lang.Thread.run(Thread.java:744)

root cause 
java.lang.InstantiationException sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
java.lang.reflect.Constructor.newInstance(Constructor.java:526)
java.lang.Class.newInstance(Class.java:374) 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.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2430
org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2419
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:744)


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