简体   繁体   English

Tomcat servlet-api.jar问题

[英]Tomcat servlet-api.jar problem

I am running a web application using Tomcat and Java Servlets, JSP's, etc. 我正在使用Tomcat和Java Servlet,JSP等运行Web应用程序。

I am aware that in order to use Servlets, it is dependent on the Servlet-api.jar file. 我知道,为了使用Servlet,它依赖于Servlet-api.jar文件。 Initially I placed this jar file in the 最初,我将此jar文件放在

WEB-INF/lib/
directory. 目录。

This has worked fine for me for months during the developmental phase. 在开发阶段,这对我来说已经好几个月了。

When we put the application onto the server space we are using, we started seeing wierd problems showing up in the Catalina.out file telling us that there was dependency problems with the servlet-api.jar file. 当我们将应用程序放到我们正在使用的服务器空间上时,我们开始看到Catalina.out文件中出现了一些奇怪的问题,告诉我们servlet-api.jar文件存在依赖关系问题。

I am aware that tomcat has this jar file in its container, and that I should remove it from the 我知道tomcat的容器中有这个jar文件,应该将其从

 WEB-INF/lib/ WEB-INF / lib目录/ 
directory. 目录。 I have tried this and it does not work. 我已经尝试过了,但是行不通。

What do I have to do when I remove this jar file from the local files and allow it to depend on tomcats servlet-api.jar file. 当我从本地文件中删除此jar文件并使它依赖于tomcats servlet-api.jar文件时,我该怎么办。

EDIT: This is the exact message pulled from my Catalina.out file that I have been receiving. 编辑:这是从我收到的Catalina.out文件中提取的确切消息。 I added the external JAR to the class path, and It worked, but I am receiving this problem. 我将外部JAR添加到类路径中,并且可以正常工作,但是我收到了这个问题。

 May 17, 2010 12:33:31 PM org.apache.catalina.loader.WebappClassLoader validateJarFile 2010年5月17日,下午12:33:31 org.apache.catalina.loader.WebappClassLoader validateJarFile 
\nINFO: validateJarFile(/home/weremo/appservers/apache-tomcat-6.0.26/webapps/WMA-Test/WEB- 信息:validateJarFile(/home/weremo/appservers/apache-tomcat-6.0.26/webapps/WMA-Test/WEB-
INF/lib/servlet-api.jar) - jar not loaded. INF / lib / servlet-api.jar)-未加载jar。 See Servlet Spec 2.3, section 9.7.2. 请参阅Servlet规范2.3,第9.7.2节。
Offending class: javax/servlet/Servlet.class 令人反感的类:javax / servlet / Servlet.class

Servlet-api.jar is by default provided by the container environment. 默认情况下,容器环境提供Servlet-api.jar。 So you should not put it in your WEB-INF/LIB folder when you are deploying your application. 因此,在部署应用程序时,请勿将其放在WEB-INF / LIB文件夹中。 However, it is required for compiling your Servlets. 但是,编译Servlet是必需的。 In case if you are using Eclipse as your IDE, place it in your classpath using Add External JAR files option. 如果您使用Eclipse作为IDE,请使用“添加外部JAR文件”选项将其放置在类路径中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM