Could not instantiate bean class [com.wms.web.action.inquiry.ItemQueryAction]: Constructor threw exc

来源:互联网 发布:c语言graphics图库 编辑:程序博客网 时间:2024/05/20 18:17
[framework] 2012-03-04 14:00:08,187 - org.springframework.web.context.ContextLoader -16   [main] ERROR org.springframework.web.context.ContextLoader  - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ItemQueryAction' defined in ServletContext resource [/WEB-INF/applicationContext_inquiry.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.wms.web.action.inquiry.ItemQueryAction]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:813)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:769)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:412)



采用的框架是:struts2 + hibernate3 + spring2.0

原因 :

在/WEB-INF/applicationContext_inquiry.xml 配置action的时候,使用的是:

<bean name="ItemQueryAction"
class="com.wms.web.action.inquiry.ItemQueryAction">
<property name="itemDao">
<ref bean="ItemDAOProxy"/>
</property> 
</bean>


而不是:

<bean name="ItemQueryAction"
class="com.wms.web.action.inquiry.ItemQueryAction" scope="prototype">
<property name="itemDao">
<ref bean="ItemDAOProxy"/>
</property> 
</bean>

故报错。




原创粉丝点击