Tomcat servlet-api.jar问题
我正在使用 Tomcat 和 Java Servlet、JSP 等运行 Web 应用程序。
我知道为了使用 Servlet,它依赖于 Servlet-api.jar 文件。最初我把这个jar文件放在
WEB-INF/lib/directory.
在开发阶段的几个月里,这对我来说效果很好。
当我们将应用程序放到我们正在使用的服务器空间上时,我们开始看到 Catalina.out 文件中出现奇怪的问题,告诉我们 servlet-api.jar 文件存在依赖性问题。
我知道 tomcat 的容器中有这个 jar 文件,我应该将其从
WEB-INF/lib/directory. I have tried this and it does not work.
当我从本地文件中删除这个jar文件并允许它依赖于tomcats servlet-api.jar文件时,我该怎么办?
编辑:这是从我收到的 Catalina.out 文件中提取的确切消息。我将外部 JAR 添加到类路径中,并且它有效,但我遇到了这个问题。
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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Servlet-api.jar 默认由容器环境提供。因此,在部署应用程序时,不应将其放在 WEB-INF/LIB 文件夹中。但是,它是编译 Servlet 所必需的。如果您使用 Eclipse 作为 IDE,请使用“添加外部 JAR 文件”选项将其放置在类路径中。
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.