繁体   English   中英

在tomcat 7中初始化应用程序时,Spring CannotLoadBeanClassException

[英]Spring CannotLoadBeanClassException when initializaing app in tomcat 7

在Tomcat 7启动中初始化bean时遇到问题。 我最怀疑的是它的定义为null。

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.DefaultListableBeanFactory@3c133d32: 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.

任何指导将不胜感激,谢谢。

根本原因是ClassNotFoundException ,缺少类es.sacnet.hdc.bsg.webservices.impl.BSGenericoCommonImpl

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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