Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring@Transactional配置xml_Java_Xml_Spring_Spring Mvc_Transactions - Fatal编程技术网

Java Spring@Transactional配置xml

Java Spring@Transactional配置xml,java,xml,spring,spring-mvc,transactions,Java,Xml,Spring,Spring Mvc,Transactions,事务中的回滚不起作用(Spring 3.1)。我试图编辑我的配置xml文件,如,但没有结果。 这里是我的xml文件: <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns="http://www.springfra

事务中的回滚不起作用(Spring 3.1)。我试图编辑我的配置xml文件,如,但没有结果。 这里是我的xml文件:

    <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:mvc="http://www.springframework.org/schema/mvc" 
        xmlns="http://www.springframework.org/schema/beans"
        xmlns:jee="http://www.springframework.org/schema/jee"
        xmlns:aop= "http://www.springframework.org/schema/aop"
        xmlns:tx= "http://www.springframework.org/schema/tx"
        xmlns:jpa="http://www.springframework.org/schema/data/jpa"
        xsi:schemaLocation="
                http://www.springframework.org/schema/mvc 
                http://www.springframework.org/schema/mvc/spring-mvc.xsd 
                http://www.springframework.org/schema/jee   
                http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
                http://www.springframework.org/schema/beans
                http://www.springframework.org/schema/beans/spring-beans.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
                http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
                ">
    
        <jee:jndi-lookup id="dataSourceUsrAppe1" jndi-name="jdbc/ZhabDS"/>
        
        <bean id="utentiDAO" class="it.dao.UtentiDAO">
            <property name="dataSourceUsrAppe1">
                <ref bean="dataSourceUsrAppe1"/>
            </property>
        </bean>
<!--    doesn't work with this:
        <tx:annotation-driven transaction-manager="txManager"/>
            <property name="dataSourceUsrAppe1">
                <ref bean="dataSourceUsrAppe1"/>
            </property>
        </bean>  
    </beans>
-->
</beans>
异常被正确抛出,从控制器捕获,并且数据库未回滚。
我是否缺少xml中的任何配置?

使用以下xml配置

<!-- Enable Annotation based Declarative Transaction Management -->
<tx:annotation-driven proxy-target-class="true"
    transaction-manager="transactionManager" />

<!-- Creating TransactionManager Bean, since JDBC we are creating of type 
    DataSourceTransactionManager -->
<bean id="transactionManager"
    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSourceUsrAppe1" />
</bean>

使用以下xml配置

<!-- Enable Annotation based Declarative Transaction Management -->
<tx:annotation-driven proxy-target-class="true"
    transaction-manager="transactionManager" />

<!-- Creating TransactionManager Bean, since JDBC we are creating of type 
    DataSourceTransactionManager -->
<bean id="transactionManager"
    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSourceUsrAppe1" />
</bean>


您的事务管理器来自哪里?您检查过日志了吗?事务是否正在启动和提交?我不知道如何配置它。我应该移除这个吗?我删除了它,没有在服务器上运行,它给了我错误。你的事务管理器来自哪里?你检查了日志了吗?事务是否正在启动和提交?我不知道如何配置它。我应该移除这个吗?我删除了它,不在服务器上运行,它给了我错误。谢谢,这工作!奇怪的是,在此之后,我刚刚在调试模式下从eclipse中得到一个新的奇怪弹出错误(之后我清理了所有旧的断点):由于缺少行编译器属性,无法安装断点it.service.UtenistService$$…CGLIB…$$someHEXnumber。修改编译器选项以生成行号属性。原因:缺少行号信息。谢谢,这很有效!奇怪的是,在此之后,我刚刚在调试模式下从eclipse中得到一个新的奇怪弹出错误(之后我清理了所有旧的断点):由于缺少行编译器属性,无法安装断点it.service.UtenistService$$…CGLIB…$$someHEXnumber。修改编译器选项以生成行号属性。原因:缺少行号信息。