简体   繁体   中英

Eclipse - web app Tomcat deployment borked

Any help will be much appreciated. I am running a web application which depends on two other projects in my work space. These two projects further depend on 3 other projects in my workspace. There are no errors with any of the projects within the work space. Running the web app within Tomcat produces the following error:

java.lang.NoClassDefFoundError: com/tele/misc/DefaultApplicationModule

Which is a class within the first level of dependent projects. All was working fine up until recently. This is obviously some sort of classpath issue? Any suggestions on how to find this within Eclipse metadata and fix this?

More detail:

Console:

*******************************************************************
*** WARNING: Apache MyFaces-2 is running in DEVELOPMENT mode.   ***
***                                         ^^^^^^^^^^^         ***
*** Do NOT deploy to your live server(s) without changing this. ***
*** See Application#getProjectStage() for more information.     ***
*******************************************************************

Feb 13, 2014 1:41:18 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Feb 13, 2014 1:41:18 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/CRGen] startup failed due to previous errors
Feb 13, 2014 1:41:18 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class         za.co.huge.processor.CRToolContextListener
java.lang.NoClassDefFoundError: com/tele/misc/DefaultApplicationModule
    at za.co.huge.processor.ReportProcessor.<init>(ReportProcessor.java:30)
    at za.co.huge.processor.ReportProcessor.getInstance(ReportProcessor.java:41)
    at     za.co.huge.processor.CRToolContextListener.contextDestroyed(CRToolContextListener.java:22)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4927)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5573)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
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$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
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:724)

Feb 13, 2014 1:41:18 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Feb 13, 2014 1:41:18 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Feb 13, 2014 1:41:18 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2547 ms

All of this originating from my servlet context listener:

<!-- CRTool Context listener starts report processing Engine -->
<listener>
    <listener-class>za.co.huge.processor.CRToolContextListener</listener-class>
</listener>

Which fails when init on Guice modules from the dependant project:

/* singleton design pattern - so only one service thread can be running */
private ReportProcessor(final long sleepTime){
    serviceThread = new ServiceThread(sleepTime);
    thread = new Thread(serviceThread);
    thread.setPriority(Thread.MIN_PRIORITY);
    final Injector injector = Guice.createInjector(new     DefaultApplicationModule());
//      final Injector injector = Guice.createInjector(new CommissionsModule(), new     DefaultApplicationModule());
//      ci = injector.getInstance(CommissionsImpl.class);
    }

After you compile your code, you end up with .class files for each class in your program. These binary files are the bytecode that Java interprets to execute your program. The NoClassDefFoundError indicates that the classloader, which is responsible for dynamically loading classes, cannot find the .class file for the class that you're trying to use. It probably indicates that you haven't set the classpath option when executing your code. This link explains how to set the classpath when you execute. http://en.wikipedia.org/wiki/Classpath_%28Java%29

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM