jar没装。请参见Servlet规范2.3,第9.7.2节。违规类:javax / servlet / Servlet.class [英] jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

查看:405
本文介绍了jar没装。请参见Servlet规范2.3,第9.7.2节。违规类:javax / servlet / Servlet.class的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个也是一个动态Web项目的Maven项目。我在maven中使用了所有的弹簧库。我创建了 web.xml ,但是当我启动我的tomcat 7服务器时,我收到以下消息:

  INFO:validateJarFile(C:\Users\mibvzd0\workspace\.metadata\.plugins\ 
org.eclipse.wst.server.core\tmp2\\ \\ wtpwebapps\hapi_hl7\WEB-INF\lib\
servlet-api-2.4.jar) - jar没有加载。
请参阅Servlet规范2.3,第9.7.2节。我尝试从webapp / lib中删除servlet,但是,我尝试从webapp / lib中删除servlet,但是这个类似于javax / servlet / Servlet.class



<它没有工作。让我知道在我的情况下应该做什么。

解决方案

servlet API .jar文件不能嵌入webapp中显然,容器已经在类路径中已经有这些类:它实现了这个jar包中的接口。



依赖关系应该在中提供范围,而不是默认的编译范围,在您的Maven pom中:

 <依赖性> 
< groupId> javax.servlet< / groupId>
< artifactId> javax.servlet-api< / artifactId>
< version> 3.1.0< / version>
< scope>已提供< / scope>
< / dependency>


I am running a Maven project which is also a dynamic web project. I have used all spring libraries in maven. I created web.xml, but when I start my tomcat 7 server I am getting the following message:

INFO: validateJarFile(C:\Users\mibvzd0\workspace\.metadata\.plugins\
org.eclipse.wst.server.core\tmp2\wtpwebapps\hapi_hl7\WEB-INF\lib\
servlet-api-2.4.jar) - jar not loaded.
See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

I tried deleting the servlet from webapp/lib, but it didn't work. Let me know what should be done in my case.

解决方案

The servlet API .jar file must not be embedded inside the webapp since, obviously, the container already has these classes in its classpath: it implements the interfaces contained in this jar.

The dependency should be in the provided scope, rather than the default compile scope, in your Maven pom:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <scope>provided</scope>
</dependency>

这篇关于jar没装。请参见Servlet规范2.3,第9.7.2节。违规类:javax / servlet / Servlet.class的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆