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

修改web.xml后,启动tomcat5失败
在我修改web.xml文件之前,啟動tomcat5正常,在我修改后,就出現錯誤了,再啟動weblogic,也是正常的,為什么?謝謝大家。(我用的是myeclipse) 
錯誤信息如下: 
2007-10-13 16:04:11 org.apache.catalina.startup.ContextConfig applicationConfig 
严重: Occurred at line 9 column 19 
2007-10-13 16:04:11 org.apache.catalina.startup.ContextConfig start 
严重: Marking this application unavailable due to previous error 
2007-10-13 16:04:11 org.apache.catalina.core.StandardContext start 
严重: Error getConfigured 
2007-10-13 16:04:11 org.apache.catalina.core.StandardContext start 
严重: Context startup failed due to previous errors 
2007-10-13 16:04:11 org.apache.catalina.core.StandardHostDeployer install 
信息: Installing web application at context path /jsp-examples from URL file:F:\jakarta-tomcat-5.0.27\jakarta-tomcat-5.0.27\webapps\jsp-examples 

web.xml 

<web-app> 
<servlet> 
<servlet-name>HelloWorld</servlet-name> 
<servlet-class>com.test.HelloWorld</servlet-class> 
</servlet> 
<servlet-mapping> 
<servlet-name>HelloWorld</servlet-name> 
<url-pattern>asdf</url-pattern> 
</servlet-mapping> 
</web-app> 


------解决方案--------------------
少<?xml version="1.0" encoding="ISO-8859-1"?>
少/
<servlet-mapping > 
<servlet-name >HelloWorld </servlet-name > 
<url-pattern >/asdf </url-pattern > 
</servlet-mapping >
------解决方案--------------------
楼上正解.
------解决方案--------------------
你应该在<web-app > 前面加上:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
然后再接上<web-app>
最后注意的就是你的<url-pattern >asdf</url-pattern > 处理路径一定要写对!
------解决方案--------------------
<servlet-mapping >
<servlet-name >HelloWorld </servlet-name >
<url-pattern >/asdf </url-pattern >
</servlet-mapping >