问题描述
win7系统+jdk1.6+myeclipse8.5启动报错代码严重:Contextinitializationfailedorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'g3ShopBoss'definedinclasspathresource[spring/spring_g3shop.xml]:Instantiationofbeanfailed;nestedexceptionisjava.lang.NoClassDefFoundError:javax/ejb/CreateExceptionatorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)atjava.security.AccessController.doPrivileged(NativeMethod)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)atorg.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4205)atorg.apache.catalina.core.StandardContext.start(StandardContext.java:4704)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)atorg.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)atorg.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)atorg.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)atorg.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)atorg.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)atorg.apache.catalina.core.StandardHost.start(StandardHost.java:840)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)atorg.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)atorg.apache.catalina.core.StandardService.start(StandardService.java:525)atorg.apache.catalina.core.StandardServer.start(StandardServer.java:754)atorg.apache.catalina.startup.Catalina.start(Catalina.java:595)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:597)atorg.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)atorg.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)Causedby:java.lang.NoClassDefFoundError:javax/ejb/CreateExceptionatjava.lang.Class.getDeclaredConstructors0(NativeMethod)atjava.lang.Class.privateGetDeclaredConstructors(Class.java:2398)atjava.lang.Class.getConstructor0(Class.java:2708)atjava.lang.Class.getDeclaredConstructor(Class.java:1987)atorg.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:54)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)...40moreCausedby:java.lang.ClassNotFoundException:javax.ejb.CreateExceptionatorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)atorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)...46more2014-8-2911:18:57org.apache.catalina.core.StandardContextlistenerStart
解决方案
解决方案二:
G3ShopBoss类的spring配置文件<?xmlversion="1.0"encoding="GBK"?><!---spring平台配置--><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsd"><!--=========================Service配置===============================--><beanid="g3shopService"class="com.gohighsoft.g3.service.G3ShopServiceImp"/><beanid="g3ShopBoss"class="com.gohighsoft.g3.impl.G3ShopBoss"/><beanid="opsmsService"class="com.gohighsoft.g3.impl.OPSMSServiceImpl"/><beanid="bossImpl"class="com.gohighsoft.g3.impl.BossImpl"/><!----><beanid="g3shopBoss"class="com.gohighsoft.g3.impl.G3ShopBoss"/></beans>
解决方案三:
java.lang.ClassNotFoundException:javax.ejb.CreateExceptionjava.lang.NoClassDefFoundError:javax/ejb/CreateException看看是不是少ejb的jar包。
解决方案四:
项目是别人的,我拿来看看,lib图片图1图2图3