11

I'm configuring a new project in eclipse. my project has many modules including one of them named 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. but on runtime, I'm still getting a ClassNotFoundException as shown below

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)
jAC
  • 5,195
  • 6
  • 40
  • 55
blaiso
  • 347
  • 4
  • 6
  • 15
  • 1
    When saying "it's correctly in my classpath" it's important to actually **show** your classpath. Copy and paste it, ideally, so that typos are preserved. – T.J. Crowder Sep 25 '15 at 17:48
  • 1
    Yes, and i would add that it is not actually the classpath in Eclipse that is important, but the content of the WAR file. – Andreas Veithen Sep 25 '15 at 17:50
  • It seems you have duplicate copies – Suresh Atta Sep 25 '15 at 17:50
  • 1
    Check if your War file,look into the web-inf/lib folder inside , if you don't find this jar then you would get this error. If you are directly deploying then you would not be able to see the war. Then the best option would be to export it as a war file and check. – Abhiram mishra Sep 25 '15 at 18:00
  • 1
    Note:Having the class path configured properly in eclipse does not necessarily mean it is available to the web app you are deploying. It means that you could build the app with out compilation error. Having the right project nature ( like dynamic web app) ,eclipse ensures your given jars are copied into the war 's WEB-INF/lib folder which makes it available to the web app at the runtime. – Abhiram mishra Sep 25 '15 at 18:03

1 Answers1

11

If your project is Faceted, right click on the project and go to Properties, and choose Deployment Assembly on the left pane. Check if the dependencies exists there as Build Path entries or Archives (jars). Once this is done you may do Project>Clean and restart the server.

James Jithin
  • 10,183
  • 5
  • 36
  • 51