这是我的例外:
2015-06-29 09:27:58 [INFO]-[main]-[org.hibernate.impl.SessionFactoryImpl.close(887)]- closing
2015-06-29 09:27:58 [ERROR]-[main]-[org.springframework.web.context.ContextLoader.initWebApplicationContext(308)]- Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'subjectCcyDao' defined in file [D:\apache-tomcat-6.0.37\wtpwebapps\iEBP4JLSI-SETTLE\WEB-INF\classes\config\applicationContext-sys.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Class must not be null
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.IllegalArgumentException: Class must not be null
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.util.ReflectionUtils.findMethod(ReflectionUtils.java:150)
at org.springframework.core.BridgeMethodResolver.searchForMatch(BridgeMethodResolver.java:211)
at org.springframework.core.BridgeMethodResolver.findGenericDeclaration(BridgeMethodResolver.java:149)
at org.springframework.core.BridgeMethodResolver.isBridgeMethodFor(BridgeMethodResolver.java:136)
at org.springframework.core.BridgeMethodResolver.searchCandidates(BridgeMethodResolver.java:104)
at org.springframework.core.BridgeMethodResolver.findBridgedMethod(BridgeMethodResolver.java:78)
at org.springframework.core.annotation.AnnotationUtils.getAnnotation(AnnotationUtils.java:100)
at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:122)
at org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor.isAuthzAnnotationPresent(AuthorizationAttributeSourceAdvisor.java:107)
at org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor.matches(AuthorizationAttributeSourceAdvisor.java:84)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:226)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:263)
at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:295)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1461)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
... 26 more
但是,这个问题似乎只发生在我的电脑上,该项目在我同事的计算机上运行良好。 这是我的xml文件:
<bean id="subjectCcyDao" class="com.infohold.bdrp.sys.dao.impl.SubjectCcyDaoImpl" >
<constructor-arg value="com.infohold.bdrp.sys.model.SubjectCcy" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="subjectCcyManager" class="com.infohold.bdrp.sys.service.impl.SubjectCcyManagerImpl">
<constructor-arg ref="subjectCcyDao" />
<property name="subjectCcyDao" ref="subjectCcyDao" />
</bean>
<bean id="subjecCcyAction" class="com.infohold.bdrp.sys.action.SubjecCcyAction" parent="baseAction" scope="prototype">
<property name="subjectCcyManager" ref="subjectCcyManager" />
<property name="subjectDictManager" ref="subjectDictManager" />
</bean>
当我注释掉这个xml时,错过了错误。但是我仍然无法找出错误。 我整天都在谷歌这个问题找不到答案。那么,谁能告诉我原因呢?谢谢。
答案 0 :(得分:2)
EDIT(2016/02/22):我确认在我的情况下,通过迁移到Spring 3.1.4解决了这个问题
我没有干净的解决方案,但有一些线索。
当我从Java 1.7.0_75切换到Java 1.8.0_74时,会发生此错误。我怀疑它与Java 8中的反射实现的变化有关。
我们使用Spring 3.1.3并且我认为这个问题可能会在3.1.4中修复 - https://jira.spring.io/browse/SPR-9330
当我探索堆栈跟踪时,我注意到当Spring Security尝试在代码中查找@Secured
注释时会发生此错误。通过将secured-annotations
设置为disabled
,可以禁用此功能(如果您确实不需要),例如:
<security:global-method-security secured-annotations="disabled" />
答案 1 :(得分:0)
如果您正在使用spring集成,则必须创建该类对象的setter方法并在应用程序context.xml文件中进行配置
答案 2 :(得分:0)
您确定类名具有正确的拼写吗?
class="com.infohold.bdrp.sys.action.SubjecCcyAction"
应该是
class="com.infohold.bdrp.sys.action.SubjectCcyAction"
与其他人一样,这是'subjec t '和't'。