【问题标题】:What does this jar not loading error mean?这个jar没有加载错误是什么意思?
【发布时间】:2015-07-03 04:33:20
【问题描述】:

错误

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

表示servlet-api 已经加载完毕。所以重复导致了这个问题。

如果我错了,请纠正我。

我的错误

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

这是我的错误。这是否意味着已经添加了 myApp.jar 并尝试再次添加它是错误的。或者 servlet-api jar 被复制。

请帮助我理解这一点。

【问题讨论】:

标签: java eclipse maven servlets


【解决方案1】:

战争不能包含与 servlet 相关的 jar。

WEB-INF/lib 中删除servlet-api-2.4.jar 以解决此问题。

这是因为 servlet 容器(tomcat、jetty、jboss...)有它自己的 servlet-api.jar 并且您不能覆盖它。

如果你使用 maven 试试这个

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

提供的范围通知必须在打包时将 jar 从战争中排除。

【讨论】:

  • wtpwebapps/.../myProjet/web-inf/lib下没有这个jar。
猜你喜欢
  • 1970-01-01
  • 2018-11-29
  • 2011-03-01
  • 2012-11-06
  • 2012-10-20
相关资源
最近更新 更多