初学者再问Tomcat问题,简单得不能再简单,就是搞不定
拜托各位耐心教教我,这个问题今晚一定要搞定!!!
我在/webapps下建立了new文件,new下建立了WEB-INF和index.jsp,WEB-INF下建立了web.xml和classes和lib(classes和lib都是空的)。
index.jsp中内容如下:
<%@ page language= "java " %>
<html>
<head>
<title> Hello World! </title>
</head>
<body bgcolor= "#FFFFFF " text= "#000000 ">
<% out.println( "Hello World! "); %>
</body>
</html>
web.xml中内容如下:
<?xml version= "1.0 " encoding= "ISO-8859-1 "?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License ");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS " BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<web-app xmlns= "http://java.sun.com/xml/ns/j2ee "
xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance "
xsi:schemaLocation= "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd "
version= "2.4 ">
<display-name> Welcome to Tomcat </display-name>
<description>
Welcome to Tomcat
</description>
<!-- JSPC servlet mappings start -->
<servlet>
<servlet-name> org.apache.jsp.index_jsp </servlet-name>
<servlet-class> org.apache.jsp.index_jsp </servlet-class>
</servlet>
<servlet-mapping>
<servlet-name> org.apache.jsp.index_jsp </servlet-name>
<url-pattern> /index.jsp </url-pattern>
</servlet-mapping>
<!-- JSPC servlet mappings end -->
</web-app>
打开浏览器,输入:http://localhost:8080/new/
显示:
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: Wrapper cannot find servlet class org.apache.jsp.index_jsp or a class it depends on
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(Unknown Source)
root cause
java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
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(Unknown Source)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
--------------------------------------------
Apache Tomcat/5.0.28
[解决办法]
鼓励一下初学者
[解决办法]
web.xml配置有错
初学还是借用一下IDE吧。还是有点帮助的
[解决办法]
怀疑是这个。楼主的文件可能是index.jsp.jsp扩展名被隐藏了,你访问http://localhost:8080/new/index.jsp.jsp
[解决办法]
你留下个QQ,窝给你 传一个
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html