简体   繁体   English

ClassNotFoundException,即使包含该类的jar正确存在于类路径中

[英]ClassNotFoundException even though the jar containing the class is properly present in the classpath

I'm configuring a new project in eclipse. 我正在eclipse中配置一个新项目。 my project has many modules including one of them named eas.core. 我的项目有很多模块,其中一个名为eas.core。 to the buildPath of my eas.core module, i have added a jar file common.jcr.jar containing a class named ContentRepositorySettings , that I'm using into my codes. 在我的eas.core模块的buildPath中,我添加了一个jar文件common.jcr.jar,其中包含一个名为ContentRepositorySettings的类,我正在使用我的代码。 but on runtime, I'm still getting a ClassNotFoundException as shown below 但是在运行时,我仍然得到一个ClassNotFoundException ,如下所示

java.lang.NoClassDefFoundError: cm/bao/common/jcr/ContentRepositorySettings
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2944)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
at cm.bao.eas.core.ElectronicArchivingApplicationImpl.setupGlobalSettings(ElectronicArchivingApplicationImpl.java:33)
at cm.bao.eas.core.ElectronicArchivingApplicationImpl.start(ElectronicArchivingApplicationImpl.java:49)
at cm.bao.eas.ui.gwt.server.listner.ElectronicArchivingContextListner.contextInitialized(ElectronicArchivingContextListner.java:18)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: cm.bao.common.jcr.ContentRepositorySettings
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)

If your project is Faceted , right click on the project and go to Properties , and choose Deployment Assembly on the left pane. 如果您的项目是Faceted ,请右键单击该项目并转到Properties ,然后在左窗格中选择Deployment Assembly Check if the dependencies exists there as Build Path entries or Archives (jars). 检查依赖关系是否存在于Build Path条目或Archives (jar)中。 Once this is done you may do Project > Clean and restart the server. 完成此操作后,您可以执行Project > Clean并重新启动服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NoClassDefFoundError 即使 Jar 存在于类路径中 - NoClassDefFoundError even though Jar is present in classpath ClassNotFoundException,即使包含JAR是构建的一部分 - ClassNotFoundException, even though the containing JAR is part of the build 尽管jar在类路径中,但获取ClassNotFoundException - Getting ClassNotFoundException though jar is in classpath ClassNotFoundException 即使 jar tvf 显示“缺少”类 - ClassNotFoundException even though jar tvf shows the 'missing' class ClassNotFoundException即使该类已正确定义(我认为) - ClassNotFoundException even though the class is properly defined (I think) ClassNotFoundException即使jar文件存在于WEB-INF / lib目录中也会出错 - ClassNotFoundException Error even though jar file is present in WEB-INF/lib directory classpath缺少jar文件,即使指定了 - classpath missing jar file even though specified 异常:java.lang.ClassNotFoundException: javax.activation.DataHandler 即使 javax.mail.jar 在类路径下? - Exception: java.lang.ClassNotFoundException: javax.activation.DataHandler even though javax.mail.jar is under classpath? 即使Class在类路径中,Oracle的ClassNotFound异常 - ClassNotFound Exception for Oracle even though Class is in classpath "即使在类路径中的 Jar 中也找不到类" - Class not found even when in Jar in the classpath
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM