ERROR ContextLoader:308 - Context initialization failed
信息:InitializingSpringrootWebApplicationContext14:36:20,364ERRORContextLoader:308-Cont...
信息: Initializing Spring root WebApplicationContext
14:36:20,364 ERROR ContextLoader:308 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/identity' defined in file [D:\Program Files\apache-tomcat-6.0.30\webapps\sh3\WEB-INF\classes\application.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'service' of bean class [com.lovo.action.IdentityAction]: Bean property 'service' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
我的application.xml的一部分是这样写的
<!-- 完成dao的注册,abstract="true"指明该类为抽象类 -->
<bean id="baseDao"
class="org.springframework.orm.hibernate3.support.HibernateDaoSupport"
abstract="true">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 完成业务组件的注册, parent="baseDao"指明该类的父类 -->
<bean id="ms" class="com.lovo.service.impl.IdentityServiceImpl"
parent="baseDao"></bean>
<!-- 完成action注册,name表示客户端请求路径 -->
<bean name="/identity" class="com.lovo.action.IdentityAction">
<property name="service" ref="ms"></property>
</bean> 展开
14:36:20,364 ERROR ContextLoader:308 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/identity' defined in file [D:\Program Files\apache-tomcat-6.0.30\webapps\sh3\WEB-INF\classes\application.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'service' of bean class [com.lovo.action.IdentityAction]: Bean property 'service' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
我的application.xml的一部分是这样写的
<!-- 完成dao的注册,abstract="true"指明该类为抽象类 -->
<bean id="baseDao"
class="org.springframework.orm.hibernate3.support.HibernateDaoSupport"
abstract="true">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 完成业务组件的注册, parent="baseDao"指明该类的父类 -->
<bean id="ms" class="com.lovo.service.impl.IdentityServiceImpl"
parent="baseDao"></bean>
<!-- 完成action注册,name表示客户端请求路径 -->
<bean name="/identity" class="com.lovo.action.IdentityAction">
<property name="service" ref="ms"></property>
</bean> 展开
1个回答
展开全部
最后一步 把 name="/identity" 改成 name="identity" 试试 (去掉斜线)
<!-- 完成action注册,name表示客户端请求路径 -->
<bean name="/identity" class="com.lovo.action.IdentityAction">
<property name="service" ref="ms"></property>
</bean>
<!-- 完成action注册,name表示客户端请求路径 -->
<bean name="/identity" class="com.lovo.action.IdentityAction">
<property name="service" ref="ms"></property>
</bean>
更多追问追答
追问
还是报错,能不能给我发个你腾讯,帮我调一下,我弄了一中午一下午了。
这句话不加就不报错,加了就报。
追答
912440916@qq.com 工程发我邮箱吧
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询