日期:2014-05-18  浏览次数:20657 次

我的 servlet 起不到作用咱回事呀? 急死了
我的   servlet   怎么会出错啊,
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:   Error   allocating   a   servlet   instance
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:595)

web.xml

<?xml   version= "1.0 "   encoding= "ISO-8859-1 "?>
<!DOCTYPE       web-app       PUBLIC       "-//Sun       Microsystems,       Inc.//DTD       Web       Application       1.2//EN "       "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd ">      

<web-app>


<!--   JSPC   servlet   mappings   start   -->
      <servlet>
                <servlet-name> HelloWorld </servlet-name>
                <servlet-class> HelloWorld </servlet-class>
        </servlet>

        <servlet-mapping>
                <servlet-name> HelloWorld </servlet-name>
                <url-pattern> /servlet/helloworld </url-pattern>
        </servlet-mapping>

<!--   JSPC   servlet   mappings   end   -->
</web-app>

我地址http://localhost:8080/servlet/helloworld     提示那种错误了,什么问题呀?

h

------解决方案--------------------
你要把项目的根上下文加上啊,比如你的这个servlet是test项目(这个项目的根上下文假设就是test)下面的,那么应该这么请求:
http://localhost:8080/test/servlet/helloworld
------解决方案--------------------
<servlet-class> 是SERVLET类所在的位置(CLASSES下的相对目录)
<url-pattern> 一般都这样写
<url-pattern> /helloworld </url-pattern> ]
当在你的WEB目录下 127。0。0。1:8080/WEB时遇到/helloworld表示调用 SERVLET
------解决方案--------------------
都是这样的问题,原因就是你把你的web.xml重新写一边,要copy也不要直接到网页上copy,
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.aiyiweb.com/java-web/317.html