我在网上找的整合代码 我试着自己整合了一下 但是总是报错
具体错误如下:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.interceptor.TransactionInterceptor#0': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in file [D:\devs\service\tomcat6_jdk16\webapps\Hitman\WEB-INF\classes\config\applicationContext-common1.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\devs\service\tomcat6_jdk16\webapps\Hitman\WEB-INF\classes\config\applicationContext-common1.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'hibernate.hbm2ddl.auto' of bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Nested property in path 'hibernate.hbm2ddl.auto' does not exist; nested exception is org.springframework.beans.NotReadablePropertyException: Invalid property 'hibernate' of bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Bean property 'hibernate' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
请高手帮忙解决谢谢
具体错误如下:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.interceptor.TransactionInterceptor#0': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in file [D:\devs\service\tomcat6_jdk16\webapps\Hitman\WEB-INF\classes\config\applicationContext-common1.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\devs\service\tomcat6_jdk16\webapps\Hitman\WEB-INF\classes\config\applicationContext-common1.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'hibernate.hbm2ddl.auto' of bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Nested property in path 'hibernate.hbm2ddl.auto' does not exist; nested exception is org.springframework.beans.NotReadablePropertyException: Invalid property 'hibernate' of bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Bean property 'hibernate' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
请高手帮忙解决谢谢
解决方案 »
- 求助:数据同步与死锁
- 困扰无法解决,请教各位大虾:Tomcat5.5配置连接池时的异常错误:org.apache.tomcat.dbcp.dbcp.SQLNestedException:
- java程序连接SQL数据库错误
- JAVA
- 100分求 spring ibatis webwork mysql 框架的实例,合适就给分
- 请教,关于spring mvc controller方法定义问题
- 标准型彩信平台-只需2万
- Weblogic中,JSP调用EJB问题
- eclipse(kelper)+maven+tomcat7 debug 问题
- datatables动态生成表头
- struts2.0+hibernate3+spring2.0整合问题??????
- webservice 服务端如何获得客户端的ip地址?
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreResourceNotFound" value="true" />
<property name="locations">
<list>
<value>/WEB-INF/config/jdbc.properties</value>
</list>
</property>
</bean>
<!-- c3p0 datasource -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${jdbc.driverClass}"/>
<property name="jdbcUrl" value="${jdbc.jdbcUrl}"/>
<property name="user" value="${jdbc.user}"/>
<property name="password" value="${jdbc.password}"/>
<property name="initialPoolSize" value="${jdbc.initialPoolSize}" />
<property name="maxPoolSize" value="${jdbc.maxPoolSize}" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
${hibernate.dialect}
</prop>
<prop key="hibernate.show_sql">true</prop>
<!--
<prop
key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop> <prop
key="hibernate.cache.use_structured_entries">true</prop> <prop
key="hibernate.connection.release_mode">auto</prop>
-->
</props>
</property>
<property name="packagesToScan"
value="com.mchz.common.domain.persistence" />
</bean> <bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
</beans>
事务配置错了~引用不正确
可以改成servlet来试一下
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
${hibernate.dialect}
</prop>
<prop key="hibernate.show_sql">true </prop>
<!--
<prop
key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider </prop>
<prop key="hibernate.cache.use_second_level_cache">true </prop>
<prop key="hibernate.cache.use_query_cache">true </prop> <prop
key="hibernate.cache.use_structured_entries">true </prop> <prop
key="hibernate.connection.release_mode">auto </prop>
-->
</props>
</property>
<property name="packagesToScan"
value="com.mchz.common.domain.persistence" />
</bean>
结贴了 谢谢各位!