【问题标题】:servlet-api.jar - jar not loaded on localhostservlet-api.jar - 本地主机上未加载 jar
【发布时间】:2013-04-25 14:37:00
【问题描述】:

这个 jar 没有在本地加载到我的 Tomcat 7 环境中。昨天当我关闭一天时,这工作得很好。什么都没有改变,但是当我今天早上开始时,这就是我所看到的。什么都没有改变——真的。我刚刚打开 Eclipse 开始工作和测试我的网络应用程序 - 找不到并返回 404。

什么会导致 jar 无法加载?我在项目中没有错误并已清理它。

有问题的 jar 位于:

C:\Users\me\Documents\Dev\Eclipse\J2EE_WDT\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\app.cloud.services\WEB-INF\lib

清理后的控制台输出:

Apr 25, 2013 9:38:31 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/mydomain.com] has started
Apr 25, 2013 9:38:35 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: urn:com:sun:jersey:api:view is already defined
Apr 25, 2013 9:38:35 AM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
  com.mydomain.webservices
Apr 25, 2013 9:38:35 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
  class com.mydomain.webservices.Encryption
  class com.mydomain.webservices.Codec
Apr 25, 2013 9:38:35 AM com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
Apr 25, 2013 9:38:35 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.12 02/15/2012 04:51 PM'
Apr 25, 2013 9:38:36 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/mydomain.com] is completed
Apr 25, 2013 9:38:36 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/cs.core.web] has started
Apr 25, 2013 9:38:36 AM java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path.
Ensure that the manifest does not have duplicate entries, and
that blank lines separate individual sections in both your
manifest and in the META-INF/MANIFEST.MF entry in the jar file.
Apr 25, 2013 9:38:36 AM java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path.
Ensure that the manifest does not have duplicate entries, and
that blank lines separate individual sections in both your
manifest and in the META-INF/MANIFEST.MF entry in the jar file.
Apr 25, 2013 9:38:36 AM java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path.
Ensure that the manifest does not have duplicate entries, and
that blank lines separate individual sections in both your
manifest and in the META-INF/MANIFEST.MF entry in the jar file.
Apr 25, 2013 9:38:36 AM java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path.
Ensure that the manifest does not have duplicate entries, and
that blank lines separate individual sections in both your
manifest and in the META-INF/MANIFEST.MF entry in the jar file.
Apr 25, 2013 9:38:36 AM java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path.
Ensure that the manifest does not have duplicate entries, and
that blank lines separate individual sections in both your
manifest and in the META-INF/MANIFEST.MF entry in the jar file.
Apr 25, 2013 9:38:40 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/cs.core.web] is completed
Apr 25, 2013 9:38:40 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/app.cloud.services] has started
Apr 25, 2013 9:38:41 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\me\Documents\Dev\Eclipse\J2EE_WDT\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\app.cloud.services\WEB-INF\lib\el-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/el/Expression.class
Apr 25, 2013 9:38:41 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\me\Documents\Dev\Eclipse\J2EE_WDT\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\app.cloud.services\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Apr 25, 2013 9:38:45 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: urn:com:sun:jersey:api:view is already defined
Apr 25, 2013 9:38:45 AM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
  com.app.api
Apr 25, 2013 9:38:45 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
  class com.app.api.SyncAccount
  class com.app.api.Override
  class com.app.api.SyncSchedule
  class com.app.api.SyncDevice
  class com.app.api.Register_NOTUSED
  class com.app.api.Mock
  class com.app.api.Contact
  class com.app.api.WSInit
  class com.app.api.SyncMetrics
Apr 25, 2013 9:38:45 AM com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
Apr 25, 2013 9:38:45 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.12 02/15/2012 04:51 PM'
Apr 25, 2013 9:38:45 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/app.cloud.services] is completed

编辑

我要做的是启动我的网络应用程序,由于 jar 未加载,目前无法找到该应用程序。它在物理上它应该在的位置 - 昨天再次起作用,现在到今天早上却没有。

【问题讨论】:

  • 罐子在哪里?你是如何将它添加到你的类路径中的?
  • @SotiriosDelimanolis 是 servlet-api.jar。看起来 OP 没有运行 Tomcat,或者 Tomcat 安装以某种方式损坏。
  • 请让我们现在告诉我们您到底要做什么以及您在哪里(哪个应用程序)收到错误以及错误消息/详细信息。您在浏览器中访问 Web 应用程序时是否收到 404,或者您的 Eclipse 无法找到 jar 或两者都找不到?
  • @SotiriosDelimanolis 这意味着 OP 正在工作区文件夹中部署 tomcat 应用程序(是的,对于初学者来说,这是一个未知的坏习惯)。 OP 应该尝试在 tomcat 文件夹中部署应用程序并从 WEB-INF/lib 中删除此 servlet-api.jar
  • 照 Luiggi Mendoza 说的做。 Tomcat 抛出错误,因为您尝试加载 servlet-api.jar 两次(再次从您的 WEB-INF/lib 文件夹),而 Tomcat 已经可以使用它。

标签: java jar http-status-code-404


【解决方案1】:

servlet-api.jar 是从 tomcat_home/lib 目录加载的。我可以建议你清理 tomcat 服务器并重新启动它。要清理 tomcat,您需要执行“窗口 -> 显示视图 -> 其他 -> 服务器”,您将能够看到 tomcat 服务器。右键单击并点击“清理...”。希望这能解决您的问题,因为它昨天运行良好,但今天突然无法正常运行,没有任何变化。

【讨论】:

  • 在我看来已经有了服务器视图。但是感谢有关清理 tomcat 工作目录的建议。
  • 我注意到工作目录缺少我的所有 jsp 文件以及样式和 javascript 文件的文件夹。当我手动将它们复制到工作目录中时,我的所有网页都会再次运行。不知道为什么他们没有被部署(为什么被删除)。
猜你喜欢
  • 2012-06-15
  • 2012-01-04
  • 2018-11-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-01-21
  • 2014-03-02
  • 2021-11-19
相关资源
最近更新 更多