【发布时间】:2016-01-02 23:56:42
【问题描述】:
我将所有 jar 文件保存在 Web-content/WEB-INF/lib 中并构建到 Java-Resources/Libraries 中。我的项目在过去 2 周一直运行良好,但是,今天突然间所有依赖项都抛出 ClassNotFoundException。请帮忙。
我还尝试将所有 jar 文件保存在另一个文件夹中并使用 Java Build Path > 库 添加它们。
奇怪的是,所有的 jars 都添加到 libraries 下,直到昨天一切正常!!
编辑:我在 WEB-INF/lib 中制作了两个 jar 副本(简单的复制粘贴),然后使用构建路径再次添加它们(新副本)(所以,现在每个都有两个实例)。这解决了问题。 对为什么会发生这种情况有何看法?
编辑 2:我的类路径文件:(当我尝试不同的方法来解决我的问题时,创建了多个 jar 文件副本和“依赖”文件夹)
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_45">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/jstl-1.2.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-codec-1.9.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/poi-ooxml-3.13-20150929.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/poi-ooxml-schemas-3.13-20150929.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/xmlbeans-2.6.0.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-logging-1.1.3.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/junit-4.12.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/poi-excelant-3.13-20150929.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/poi-scratchpad-3.13-20150929.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-fileupload-1.3.1.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-io-2.4.jar"/>
<classpathentry kind="lib" path="WebContent/dependecies/commons-codec-1.9.jar"/>
<classpathentry kind="lib" path="WebContent/dependecies/commons-fileupload-1.3.1.jar"/>
<classpathentry kind="lib" path="WebContent/dependecies/commons-io-2.4.jar"/>
<classpathentry kind="lib" path="WebContent/dependecies/commons-logging-1.1.3.jar"/>
<classpathentry kind="lib" path="WebContent/dependecies/jstl-1.2.jar"/>
<classpathentry kind="lib" path="WebContent/dependecies/junit-4.12.jar"/>
<classpathentry kind="lib" path="WebContent/dependecies/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="WebContent/dependecies/poi-excelant-3.13-20150929.jar"/>
<classpathentry kind="lib" path="WebContent/dependecies/poi-ooxml-3.13-20150929.jar"/>
<classpathentry kind="lib" path="WebContent/dependecies/poi-ooxml-schemas-3.13-20150929.jar"/>
<classpathentry kind="lib" path="WebContent/dependecies/poi-scratchpad-3.13-20150929.jar"/>
<classpathentry kind="lib" path="WebContent/dependecies/xmlbeans-2.6.0.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/mysql-connector-java.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/mysql-connector-java-5.1.13-bin.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/Copy of jstl-1.2.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/poi-3.13-20150929.jar"/>
<classpathentry kind="lib" path="WebContent/WEB-INF/lib/Copy of poi-3.13-20150929.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
【问题讨论】: