我已將所有jar文件保存在Web-content/WEB-INF/lib
之內,並且構建成Java-Resources/Libraries
。我的項目在過去的兩週內一直很順利,但是今天突然所有的依賴投擲了ClassNotFoundException
。請幫忙。如何在我的eclipse(juno)項目中包含依賴類?
我也嘗試保持所有的jar在另一個文件夾中,並使用Java添加它們Build Path> libraries。
奇怪的是,所有的罐子都加在圖書館和一切工作正常,直到昨天!
編輯:我在WEB-INF/lib(簡單的複製粘貼)中製作了兩個jar副本,並使用Build Path重新添加它們(新副本)(所以現在每個都有兩個實例)。這解決了這個問題。 任何意見爲什麼發生這種情況?
編輯2:我的類路徑文件:
<?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>
請檢查編輯 – user2473779
它看起來不錯,您是否嘗試刪除所有庫,然後再添加一次? – KirkoR
製作以前的庫的副本,並再次添加他們爲我工作,所以更換以前的庫也將工作得很好!但是爲什麼突然發生這種想法?這是否意味着日食(不使用MAVEN)不穩定? – user2473779