还是ssh整合问题?

隔夜的果酱_5566 三岩科技 软件工程师  2010-10-25 11:06:20
一启动就报这个错误?
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userdao' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.dao.imp.UserdaoImp]: Bean property 'sessionFactory' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?


Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.dao.imp.UserdaoImp]: Bean property 'sessionFactory' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?


applicationContext.xml的配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
">

<!-- 配置session工厂 -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.jdbc.batch_size">0</prop>
</props>
</property>
</bean>

<!-- 创建transcationManager 引入session工厂-->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 以下为事务的开启 -->
<tx:advice id="advice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="*" propagation="REQUIRED" read-only="true" />
</tx:attributes>
</tx:advice>

<!-- 登陆操作 -->
<bean id="userdao" class="com.dao.imp.UserdaoImp">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>

<!-- action的操作 -->
<bean name="/login" class="com.web.action.TestAction">
<property name="userdaoserver" ref="userdao"></property>
</bean>


</beans>



web.xml的配置
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<!-- spring 配置 -->

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<!-- struts 1 的配置 -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

struts-config.xml也配置了
<action-mappings >
<action
attribute="testForm"
input="/form/test.jsp"
name="testForm"
parameter="method"
path="/test"
scope="request"
type="org.springframework.web.struts.DelegatingActionProxy" />

</action-mappings>

有人说没有jar包?是这样吗?
...全文
49 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
javaemailkaifa 2010-10-25
仔细查看一下你的UserdaoImp类,是不是继承了hibernateDaoSupport,重新启动,重新部署,也有可能是jar包问题,不好说,涉及的问题太多了。
回复
JavPer 2010-10-25
异常信息贴出来完了吗!最好能把全部异常贴出来!
userDao有set和get方法吧!
回复
qianyecq 2010-10-25
怎么没看见你有配置数据源dataSource?
回复
问题解决了,我是没有继承了hibernateDaoSupport,
回复
javaclei 2010-10-25
没有看到数据源的配置 估计LZ忘了 加上数据源的配置文件试一下
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2010-10-25 11:06
社区公告
暂无公告