tomcat启动的时候报 validateJarFile jar not loaded

最近做项目要用到tomact服务器调试,本来一切正常.可是当我再次导入工程到tomact时出现错误.

如下:

2010-4-4 13:57:38 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/triffic/WEB-INF/lib/javax.servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

先不理他,运行工程,在ie中输入http://192.168.1.6:8585/triffic/

ie中出现的错误是:

type Exception report

message

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

exception

javax.servlet.ServletException: java.lang.NoSuchMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:275)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 com.yongan.util.filter.CheckLoginFilter.doFilter(CheckLoginFilter.java:55)
 com.yongan.util.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:33)

root cause

java.lang.NoSuchMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;
 org.apache.jsp.index_jsp._jspInit(index_jsp.java:37)
 org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
 org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 com.yongan.util.filter.CheckLoginFilter.doFilter(CheckLoginFilter.java:55)
 com.yongan.util.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:33)

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

后台报错:

2010-4-4 14:11:26 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
java.lang.NoSuchMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;
at org.apache.jsp.index_jsp._jspInit(index_jsp.java:37)
at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.yongan.util.filter.CheckLoginFilter.doFilter(CheckLoginFilter.java:55)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.yongan.util.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:33)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:574)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1527)
at java.lang.Thread.run(Thread.java:619)

解决方式:

D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/BS/WEB-INF/lib

把那个

javax.servlet.jar

javax.servlet.jsp.jar

删除即可!

I'm trying to running this on Tomcat
and get the following error.
Jun 18, 2004 5:18:05 PM org.apache.catalina.loader.WebappClassLoader
validateJarFile
INFO: validateJarFile(D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/BS/WEB-INF/lib/javax.servlet.jar)
- jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending
class: javax/servlet/Servlet.class

If any one could help on this, I would be realy grateful.

regards

Handan

Details:

把 webapps/maintenance/WEB-INF/lib/
下面的 servlet-api.jar 删掉吧! tomcat自己有,不需要你提供!
顺便看看其他的jar, 和 tomcat/lib 目录比较一下,tomcat已经有的,就别留着了!

这才想起,我在tomcat/common/lib/中也放入了j2ee.jar等包,去common/lib中处不必要的包后,保证tomcat/common/lib/和WEB-INF/lib这两个目录下的jar没有重复的,问题解决。
原来,tomcat 启动后先将tomcat/common/lib目录下的jar包全部读入内存,如果webapps目录里的应用程序中WEB-INF/lib目录下有相同的包,将无法加载,估计不同版本的包之间也会造成类似问题。因此建议尽量不要把jar包放入tomcat/common/lib目录下,应该放入WEB- INF/lib目录下。

Shenzhen Universiade - Shenzhen 2011 Summer Universiade

按上面的方法来做,正常运行.

你可能感兴趣的:(tomcat启动的时候报 validateJarFile jar not loaded)