iteye_21093 2009-07-01 19:33
浏览 210
已采纳

SSH整合问题!郁闷啦!

关于struts2.0.14 +spring2.5 +hibernate3.2整合的问题!tomcat6.0
望高人给解块下!

1: Error creating bean with name 'txAdvice': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager';

2:Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/applicationContext-common.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory';

3:Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext-common.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream

主要是这三个异常,好像是一类吧,不知道是spring2.5少加了那些包,还是什么的
我的spring2.5加入的包就是这三个spring.jar, aspectjrt.jar, aspectweaver.ar ;是不是少了东西了,还是与hibernate3.2有冲突的包;

applicationContext-common.xml配置如下:

<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<!-- 用DBCP数据库连接波来配置hibernate数据库连接 -->
class="org.apache.commons.dbcp.BasicDataSource">
value="com.mysql.jdbc.Driver">



</bean>
<!-- 配置sessionFactory  -->
<bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
        <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">
                org.hibernate.dialect.MySQLDialect
            </prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="format_sql">true</prop>
        </props>
    </property>
    <property name="mappingResources">
        <list>
            <value></value>
        </list>
    </property>
</bean>
<!-- 配置hibernate事物让spring来管理 -->
<bean id="transactionManager" 
      class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory">
        <ref local="sessionFactory"/>
      </property>
</bean>
<!-- 配置事物的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
        <tx:method name="add*" propagation="REQUIRED" />
        <tx:method name="delete*" propagation="REQUIRED" />
        <tx:method name="update*" propagation="REQUIRED" />
        <tx:method name="*" read-only="true" />
    </tx:attributes>
</tx:advice>
<!-- 那些类的那些方法需要事物; -->
<aop:config>
    <aop:pointcut id="allManagerMethod"
        expression="execution(* com.struts2.service.*.*(..))" />
    <aop:advisor pointcut-ref="allManagerMethod"
        advice-ref="txAdvice" />
</aop:config>

用的DBCP连接池,包以加入;

我以为是hibernate3.2少加入了jar包,把hibernate3.2 lib下所有的jar 都导入了,还是一样!把hiberater3.2有冲突的包也都
删了!也不行,弄了一天了.还没有整合好!高手们给小弟解块下吧!

  • 写回答

2条回答

  • layer555 2009-07-02 09:21
    关注

    你的配置:




    错误log:Could not parse mapping document from input stream
    问题就在于你的mappingResources的列表为空;

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛