Tomcat servlet-api.jar problem

有些话、适合烂在心里 提交于 2020-01-11 07:06:49

问题


I am running a web application using Tomcat and Java Servlets, JSP's, etc.

I am aware that in order to use Servlets, it is dependent on the Servlet-api.jar file. Initially I placed this jar file in the

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.

I am aware that tomcat has this jar file in its container, and that I should remove it from the

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.

EDIT: This is the exact message pulled from my Catalina.out file that I have been receiving. I added the external JAR to the class path, and It worked, but I am receiving this problem.

May 17, 2010 12:33:31 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/weremo/appservers/apache-tomcat-6.0.26/webapps/WMA-Test/WEB-
INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2.
Offending class: javax/servlet/Servlet.class

回答1:


Servlet-api.jar is by default provided by the container environment. So you should not put it in your WEB-INF/LIB folder when you are deploying your application. However, it is required for compiling your Servlets. In case if you are using Eclipse as your IDE, place it in your classpath using Add External JAR files option.



来源:https://stackoverflow.com/questions/2846673/tomcat-servlet-api-jar-problem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!