eclipse - Cannot launch WAR, nested exception is java.lang.NoClassDefFoundError: -
i in project uses following relevant technologies:
- maven
- spring
- java ee
- java rmi
in project, have initialization class, call ìnitservice. service responsible launching main structures program later on use. if fails, program fails.
in initservice trying set rmi server , client. far, equivalent of "helloworld". achieve purpose have interface , implementation class:
public interface icommunicator extends remote{ public boolean asknewvm() throws remoteexception; public boolean commitingsuicide() throws remoteexception; } public class rmicommunicator extends unicastremoteobject implements icommunicator{ private static final long serialversionuid = 1l; public rmicommunicator() throws remoteexception { super(); } @override public boolean asknewvm() throws remoteexception{ return false; } @override public boolean commitingsuicide() throws remoteexception{ return false; } } so far good. try compile , generate war file using mvn install command, runs without problems.
the problems arise when deploy generated war file server , try launch jetty 8.0. when that, server unable launch due following error:
[error][context.contextloader]: context initialization failed org.springframework.beans.factory.beancreationexception: error creating bean name 'initservice': invocation of init method failed; nested exception java.lang.noclassdeffounderror: net/jnd/thesis/service/loadbalancer/rmicommunicator @ org.springframework.beans.factory.annotation.initdestroyannotationbeanpostprocessor.postprocessbeforeinitialization(initdestroyannotationbeanpostprocessor.java:135) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.applybeanpostprocessorsbeforeinitialization(abstractautowirecapablebeanfactory.java:394) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1448) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:519) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:456) @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:294) @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:225) @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:291) @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:193) @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:585) @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:913) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:464) @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:384) @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:283) @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:111) @ org.eclipse.jetty.server.handler.contexthandler.callcontextinitialized(contexthandler.java:782) @ org.eclipse.jetty.servlet.servletcontexthandler.callcontextinitialized(servletcontexthandler.java:424) @ org.eclipse.jetty.server.handler.contexthandler.startcontext(contexthandler.java:774) @ org.eclipse.jetty.servlet.servletcontexthandler.startcontext(servletcontexthandler.java:249) @ org.eclipse.jetty.webapp.webappcontext.startcontext(webappcontext.java:1242) @ org.eclipse.jetty.server.handler.contexthandler.dostart(contexthandler.java:717) @ org.eclipse.jetty.webapp.webappcontext.dostart(webappcontext.java:494) @ org.eclipse.jetty.util.component.abstractlifecycle.start(abstractlifecycle.java:64) @ org.eclipse.jetty.deploy.bindings.standardstarter.processbinding(standardstarter.java:39) @ org.eclipse.jetty.deploy.applifecycle.runbindings(applifecycle.java:186) @ org.eclipse.jetty.deploy.deploymentmanager.requestappgoal(deploymentmanager.java:494) @ org.eclipse.jetty.deploy.deploymentmanager.addapp(deploymentmanager.java:141) @ org.eclipse.jetty.deploy.providers.scanningappprovider.fileadded(scanningappprovider.java:145) @ org.eclipse.jetty.deploy.providers.scanningappprovider$1.fileadded(scanningappprovider.java:56) @ org.eclipse.jetty.util.scanner.reportaddition(scanner.java:615) @ org.eclipse.jetty.util.scanner.reportdifferences(scanner.java:540) @ org.eclipse.jetty.util.scanner.scan(scanner.java:403) @ org.eclipse.jetty.util.scanner.dostart(scanner.java:337) @ org.eclipse.jetty.util.component.abstractlifecycle.start(abstractlifecycle.java:64) @ org.eclipse.jetty.deploy.providers.scanningappprovider.dostart(scanningappprovider.java:121) @ org.eclipse.jetty.util.component.abstractlifecycle.start(abstractlifecycle.java:64) @ org.eclipse.jetty.deploy.deploymentmanager.startappprovider(deploymentmanager.java:555) @ org.eclipse.jetty.deploy.deploymentmanager.dostart(deploymentmanager.java:230) @ org.eclipse.jetty.util.component.abstractlifecycle.start(abstractlifecycle.java:64) @ org.eclipse.jetty.util.component.aggregatelifecycle.dostart(aggregatelifecycle.java:81) @ org.eclipse.jetty.server.handler.abstracthandler.dostart(abstracthandler.java:58) @ org.eclipse.jetty.server.handler.handlerwrapper.dostart(handlerwrapper.java:96) @ org.eclipse.jetty.server.server.dostart(server.java:282) @ org.eclipse.jetty.util.component.abstractlifecycle.start(abstractlifecycle.java:64) @ org.eclipse.jetty.xml.xmlconfiguration$1.run(xmlconfiguration.java:1274) @ java.security.accesscontroller.doprivileged(native method) @ org.eclipse.jetty.xml.xmlconfiguration.main(xmlconfiguration.java:1197) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.eclipse.jetty.start.main.invokemain(main.java:473) @ org.eclipse.jetty.start.main.start(main.java:615) @ org.eclipse.jetty.start.main.main(main.java:96) caused by: java.lang.noclassdeffounderror: net/jnd/thesis/service/loadbalancer/rmicommunicator @ net.jnd.thesis.service.loadbalancer.vmmanager.<init>(vmmanager.java:83) @ net.jnd.thesis.service.loadbalancer.vmmanager.getinstance(vmmanager.java:104) @ net.jnd.thesis.service.loadbalancer.loadbalancerservice.start(loadbalancerservice.java:50) @ net.jnd.thesis.service.initializationservice.start(initializationservice.java:68) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.springframework.beans.factory.annotation.initdestroyannotationbeanpostprocessor$lifecycleelement.invoke(initdestroyannotationbeanpostprocessor.java:346) @ org.springframework.beans.factory.annotation.initdestroyannotationbeanpostprocessor$lifecyclemetadata.invokeinitmethods(initdestroyannotationbeanpostprocessor.java:299) @ org.springframework.beans.factory.annotation.initdestroyannotationbeanpostprocessor.postprocessbeforeinitialization(initdestroyannotationbeanpostprocessor.java:132) ... 53 more caused by: java.lang.classnotfoundexception: net.jnd.thesis.service.loadbalancer.rmicommunicator @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ java.lang.classloader.loadclass(classloader.java:358) @ org.eclipse.jetty.webapp.webappclassloader.loadclass(webappclassloader.java:430) @ org.eclipse.jetty.webapp.webappclassloader.loadclass(webappclassloader.java:383) ... 64 more i have researched forum similar problems, without success. however, did find article on problem:
and reading it, believe (though might wrong), problem 1 described in step 12:
12) java program can throw java.lang.noclassdeffounderror during linking occurs during class loading in java. 1 of example of scenario delete user class our static initializer failure example after compilation , try run program. time java.lang.noclassdeffounderror directly without java.lang.exceptionininitializererror , message noclassdeffounderror printing name of class testing/user i.e. user class testing package. watch out here root cause absent of user.class file.
read more: http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html#ixzz2z8cnlxz9
i not believe have jars missing, think guess other.how fix problem?
first rename *.war *.zip , have if compiled class exists.
else, try maven > update in ide, , make sure maven dependencies added classpath. sometime these noclassdev errors , after update , classpath check works fine again.
Comments
Post a Comment