还是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包?是这样吗?
...全文
67 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
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忘了 加上数据源的配置文件试一下

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧