问题描述
最近要做环境迁移,我把原来环境的tomcat连带应用程序整套复制至新的环境,jdk版本都一样,但是到了新环境的时候启动报错:显示自动装配出现了问题,找不到实现类等,但是在原环境以及我本地的开发环境都是好的,很郁闷:错误信息太长,我分段贴出来,望知情人帮忙看看,什么原因导致?2014-10-1019:38:08INFO[UserCacheServiceImpl]startreloaduserfromPDB.2014-10-1019:38:09INFO[UserCacheServiceImpl]usersizeis234192014-10-1019:38:10ERROR[UserCacheServiceImpl]levelencryptionerror2014-10-1019:38:16ERROR[UserCacheServiceImpl]levelencryptionerror2014-10-1019:38:17INFO[UserCacheServiceImpl]realoduserfrompdbisdone.Timeis90612014-10-1019:38:17ERROR[ContextLoader]Contextinitializationfailedorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'departmentPermissionConvertService':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.common.permission.service.PermissionServicecom.test.measure.bi.service.impl.DepartmentPermissionConvertService.permissionService;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'permissionService':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.user.UserServicecom.test.measure.common.permission.service.PermissionServiceImpl.userService;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'userService':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.common.permission.PermissionCentercom.test.measure.user.UserServiceImpl.permissionCenter;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'permissionCenter':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.department.service.IDepartmentServicecom.test.measure.common.permission.PermissionCenterImpl.departmentService;nestedexceptionisorg.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[com.test.measure.department.service.IDepartmentService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)atorg.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)atorg.apache.catalina.core.StandardContext.start(StandardContext.java:4342)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)atorg.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)atorg.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)atorg.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)atorg.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)atorg.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)atorg.apache.catalina.core.StandardHost.start(StandardHost.java:719)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)atorg.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)atorg.apache.catalina.core.StandardService.start(StandardService.java:516)atorg.apache.catalina.core.StandardServer.start(StandardServer.java:710)atorg.apache.catalina.startup.Catalina.start(Catalina.java:578)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:288)atorg.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)Causedby:org.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.common.permission.service.PermissionServicecom.test.measure.bi.service.impl.DepartmentPermissionConvertService.permissionService;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'permissionService':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.user.UserServicecom.test.measure.common.permission.service.PermissionServiceImpl.userService;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'userService':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.common.permission.PermissionCentercom.test.measure.user.UserServiceImpl.permissionCenter;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'permissionCenter':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.department.service.IDepartmentServicecom.test.measure.common.permission.PermissionCenterImpl.departmentService;nestedexceptionisorg.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[com.test.measure.department.service.IDepartmentService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:502)atorg.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282)...37more
解决方案
解决方案二:
Causedby:org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'permissionService':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.user.UserServicecom.test.measure.common.permission.service.PermissionServiceImpl.userService;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'userService':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.common.permission.PermissionCentercom.test.measure.user.UserServiceImpl.permissionCenter;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'permissionCenter':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.department.service.IDepartmentServicecom.test.measure.common.permission.PermissionCenterImpl.departmentService;nestedexceptionisorg.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[com.test.measure.department.service.IDepartmentService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474)...39moreCausedby:org.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.user.UserServicecom.test.measure.common.permission.service.PermissionServiceImpl.userService;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'userService':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.common.permission.PermissionCentercom.test.measure.user.UserServiceImpl.permissionCenter;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'permissionCenter':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.department.service.IDepartmentServicecom.test.measure.common.permission.PermissionCenterImpl.departmentService;nestedexceptionisorg.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[com.test.measure.department.service.IDepartmentService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:502)atorg.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282)...50moreCausedby:org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'userService':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.common.permission.PermissionCentercom.test.measure.user.UserServiceImpl.permissionCenter;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'permissionCenter':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.department.service.IDepartmentServicecom.test.measure.common.permission.PermissionCenterImpl.departmentService;nestedexceptionisorg.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[com.test.measure.department.service.IDepartmentService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474)...52moreCausedby:org.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.common.permission.PermissionCentercom.test.measure.user.UserServiceImpl.permissionCenter;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'permissionCenter':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.department.service.IDepartmentServicecom.test.measure.common.permission.PermissionCenterImpl.departmentService;nestedexceptionisorg.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[com.test.measure.department.service.IDepartmentService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}at
解决方案三:
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:502)atorg.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282)...63moreCausedby:org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'permissionCenter':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.department.service.IDepartmentServicecom.test.measure.common.permission.PermissionCenterImpl.departmentService;nestedexceptionisorg.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[com.test.measure.department.service.IDepartmentService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474)...65moreCausedby:org.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.test.measure.department.service.IDepartmentServicecom.test.measure.common.permission.PermissionCenterImpl.departmentService;nestedexceptionisorg.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[com.test.measure.department.service.IDepartmentService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:502)atorg.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282)...76moreCausedby:org.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[com.test.measure.department.service.IDepartmentService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}atorg.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:920)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:789)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474)...78more