2016-12-30 124 views
0

在Tomcat 7啓動時初始化bean時出現問題。我最懷疑的事情是說它定義爲null。Spring初始化tomcat 7中的應用程序時發生CannotLoadBeanClassException

的applicationContext.xml的一部分

<!-- =============================================== --> 
    <!-- CXF Web Service Definition --> 
    <!-- =============================================== --> 
    <import resource="classpath:META-INF/cxf/cxf.xml" /> 
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> 
    <jaxws:endpoint xmlns:tns="http://common.webservices.bsg.hdc.sacnet.es/" 
     id="bsgCommonWebService" implementor="es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl" 
     wsdlLocation="wsdl/BSGenericoCommonImpl.wsdl" endpointName="tns:BSGCommonWServicePort" 
     serviceName="tns:BSGCommonWServiceService" address="/BSGCommonWServicePort"> 
     <jaxws:features> 
      <bean class="org.apache.cxf.feature.LoggingFeature" /> 
     </jaxws:features> 
    </jaxws:endpoint> 

    <!-- =============================================== --> 

做MVN全新安裝時,我沒有錯誤,但是當我開始用它的項目Tomcat的7服務器,我得到如下:

... 
30 Dec 2016 12:21:25 DEBUG Creating shared instance of singleton bean 'bsgCommonWebService' 
30 Dec 2016 12:21:25 DEBUG Creating instance of bean 'bsgCommonWebService' 
30 Dec 2016 12:21:25 DEBUG Creating instance of bean '(inner bean)#2e8ec94d' 
30 Dec 2016 12:21:25 DEBUG Retrieved dependent beans for bean '(inner bean)#2e8ec94d': [bsgCommonWebService] 
30 Dec 2016 12:21:25 WARN Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bsgCommonWebService': Cannot create inner bean '(inner bean)#2e8ec94d' of type [es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl] while setting constructor argument; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl] for bean with name '(inner bean)#2e8ec94d' defined in null; nested exception is java.lang.ClassNotFoundException: es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl 
30 Dec 2016 12:21:25 DEBUG Destroying singletons in org.springframework.beans.factory.support.D[email protected]: defining beans [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,bsgCommonWebService,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,acronymDao,auxIEDSelectionDao,basicConfProjectDao,bayDao,configDao,configTypeDao,dataSetDao,gooseDao,hardwareModuleDao,hardwareModuleTypeDao,historicMeasureDao,iedConfDao,iedConfSettingParamDao,instanceDao,instanceHWModuleRel,logicaEncSpecificProjectDao,logicDao,logicPanelDao,moduleTypeDao,patternTemplateContentDao,patternTemplatesDao,projectDao,protocolCategoryDao,protocolConfDao,protocolConfPathSCLDao,protocolProfileDao,reportLogDao,settingParamDao,settingTypeDao,signalCMTDao,substationDao,tipoCMTDao,voltageDao,bayTypeDao,bayTypeVersionDao,dataSet4IEDRolDao,dataSet4IEDTypeDao,elementBayTypeDao,elemetDao,elemetTypeDao,enclavamientoDao,functionDao,goose4IEDTypeDao,hdcServerDao,iedICDDao,iedIIDDao,iedRolDao,inputDao,ldevices4IIDDao,lnode4IIDDao,logBayTypeDao,logicBayTypeDao,glogicDao,logIedICDDao,outputDao,paramTypeDao,reportLog4IEDTypeDao,rolDao,sclFileDao,signBayType4LogicDao,signBayTypeVersionDao,signIEDIIDDao,signIEDRolDao,specificProjectDao,taiDao,typeLogicBayTypeDao,voltageLevelTypeDao,asyncTaskDao,comunUtilsDao,graphicLibraryDao,communicationDao,dataTypeTemplateDao,iedDao,sclDao,bayTypeService,bayTypeVersionService,dataSet4IEDRolService,dataSet4IEDTypeService,elementBayTypeService,elementService,elementTypeService,enclavamientoService,functionService,goose4IEDTypeService,hdcServerService,iedICDService,iedIIDService,iedRolService,ldevices4IIDService,lnode4IIDService,logicBayTypeService,logicService,logIedICDService,outputService,paramTypeService,reportLog4IEDTypeService,rolService,sclFileService,signBayType4LogicService,signBayTypeVersionService,signIEDIIDService,signIEDRolService,specificProjectService,taiService,typeLogicBayTypeService,voltageLevelTypeService,asyncTaskService,comunUtilsService,graphicLibraryService,acronymService,auxIEDSelectionService,basicConfProjectService,bayService,cacheProjectService,configService,configTypeService,dataSetService,gooseService,hardwareModuleService,hardwareModuleTypeService,historicMeasureService,iedConfManager,iedConfService,iedConfSettingParamService,instanceHWModuleRelService,instanceService,logicaEncSpecificProjectService,logicPanelService,moduleTypeService,pathService,patternTemplateContentService,patternTemplatesService,projectService,protocolCategoryService,protocolConfPathSCLService,protocolConfService,protocolProfileService,reportLogService,settingParamService,settingTypeService,signalCMTService,substationService,tipoCMTService,voltageService,sclManager,communicationJaxbService,dataTypeTemplateJaxbService,sACIedService,sclJaxbService,sclService,bindingStyleConfigurableCustomConverter,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor#0,org.springframework.context.annotation.CommonAnnotationBeanPostProcessor#0,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,amqConnectionFactory,connectionFactory,defaultDestination,jmsTemplate,log4jInitialization,dozerBeanMapper,miDataSourceSATECH,customPersistenceUnitManager,jpaVendorAdapterHibernate,emf,transactionManager,org.springframework.transaction.config.internalTransactionalEventListenerFactory,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,org.dozer.Mapper,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor]; root of factory hierarchy 
30 Dec 2016 12:21:25 DEBUG Invoking destroy method 'shutdown' on bean with name 'cxf' 
30 Dec 2016 12:21:25 DEBUG Invoking destroy() on bean with name 'emf' 
30 Dec 2016 12:21:25 INFO Closing JPA EntityManagerFactory for persistence unit 'saTECH-CNF' 
30 Dec 2016 12:21:25 DEBUG HHH000031: Closing 
30 Dec 2016 12:21:25 DEBUG Implicitly destroying ServiceRegistry on de-registration of all child ServiceRegistries 
30 Dec 2016 12:21:25 DEBUG Implicitly destroying Boot-strap registry on de-registration of all child ServiceRegistries 
30 Dec 2016 12:21:25 DEBUG Remove: name=saTECH-CNF 
30 Dec 2016 12:21:25 ERROR Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bsgCommonWebService': Cannot create inner bean '(inner bean)#2e8ec94d' of type [es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl] while setting constructor argument; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl] for bean with name '(inner bean)#2e8ec94d' defined in null; nested exception is java.lang.ClassNotFoundException: es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:313) 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129) 
    at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:634) 
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:140) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) 
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) 
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) 
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) 
    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: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl] for bean with name '(inner bean)#2e8ec94d' defined in null; nested exception is java.lang.ClassNotFoundException: es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl 
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1352) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455) 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:299) 
    ... 26 more 
Caused by: java.lang.ClassNotFoundException: es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) 
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:250) 
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:394) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1397) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1344) 
    ... 28 more 
Dec 30, 2016 12:21:25 PM org.apache.catalina.core.StandardContext listenerStart 
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bsgCommonWebService': Cannot create inner bean '(inner bean)#2e8ec94d' of type [es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl] while setting constructor argument; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl] for bean with name '(inner bean)#2e8ec94d' defined in null; nested exception is java.lang.ClassNotFoundException: es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:313) 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129) 
    at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:634) 
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:140) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1143) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) 
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) 
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) 
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) 
    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: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl] for bean with name '(inner bean)#2e8ec94d' defined in null; nested exception is java.lang.ClassNotFoundException: es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl 
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1352) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455) 
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:299) 
    ... 26 more 
Caused by: java.lang.ClassNotFoundException: es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) 
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:250) 
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:394) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1397) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1344) 
    ... 28 more 

Dec 30, 2016 12:21:25 PM org.apache.catalina.core.StandardContext startInternal 
SEVERE: Error listenerStart 
Dec 30, 2016 12:21:25 PM org.apache.catalina.core.StandardContext startInternal 
SEVERE: Context [/HdC_BSGenerico] startup failed due to previous errors 
Dec 30, 2016 12:21:25 PM org.apache.catalina.core.ApplicationContext log 
INFO: Closing Spring root WebApplicationContext 
Dec 30, 2016 12:21:25 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc 
SEVERE: The web application [/HdC_BSGenerico] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 

任何指導將非常感謝,謝謝。

+0

沒有異常抱怨:'java.lang.ClassNotFoundException:es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl' – Ralph

回答

0

根本原因是ClassNotFoundException,類es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl丟失。

+0

感謝您的回覆。對不起,遲到回答,聖誕節。事情是這個類實際上存在於這個項目的源頭中。是的:整個包是正確的。那麼我錯過了什麼,我需要添加?有史以來第一次有這個問題。提前致謝 – ldepablo

相關問題