首页 新闻 搜索 专区 学院

bugumongo+spring+strtus2

0
悬赏园豆:50 [已解决问题] 解决于 2018-12-26 10:25

//java代码

@Component
public class AdminDao extends BuguDao {

public AdminDao() {
super(Admin.class);
}

}

 

<!--spring 配置-->

<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<property name="realm" ref="myRealm"/>
<property name="sessionMode" value="native"/>
<property name="sessionManager" ref="sessionManager"/>
</bean>
<bean id="sessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager">
<property name="sessionDAO" ref="sessionDAO"/>
<property name="globalSessionTimeout" value="3600000"></property>
</bean>
<bean id="sessionDAO" class="org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO">
</bean>

<bean id="myRealm" class="cn.eyes.commons.utils.MongodbRealm">
<property name="adminDao" ref="adminDao"></property>
</bean>
<bean id="rolesAny" class="cn.eyes.commons.context.RolesAnyAuthorizationFilter">
</bean>

 

<!--启动报异常-->

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myRealm' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Cannot resolve reference to bean 'adminDao' while setting bean property 'adminDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminDao' defined in file [E:\apache-tomcat-8.0.33\webapps\eyes\WEB-INF\classes\cn\eyes\core\admin\AdminDao.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [cn.eyes.core.admin.AdminDao]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at org.springframework.beans.factory.support.AbstractAutowireCa
pableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
... 37 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminDao' defined in file [E:\apache-tomcat-8.0.33\webapps\eyes\WEB-INF\classes\cn\eyes\core\admin\AdminDao.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [cn.eyes.core.admin.AdminDao]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
... 47 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [cn.eyes.core.admin.AdminDao]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:162)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
... 55 more
Caused by: java.lang.NullPointerException
at com.bugull.mongo.BuguDao.<init>(BuguDao.java:61)
at cn.eyes.core.admin.AdminDao.<init>(AdminDao.java:13)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
... 57 more

 

 

 

---求哪路大神给看看,对这个bugumongo还不是很熟悉

 

 

C_林先森的主页 C_林先森 | 初学一级 | 园豆:60
提问于:2016-06-28 17:46
< >
分享
最佳答案
0

你的这个 AdminDao 没有通过xml设置,而你也可能没有开启包扫描。。

在xml里面设置一下bean就可以了

收获园豆:50
之奇一昂 | 小虾三级 |园豆:1421 | 2016-07-25 17:37
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册