spring + ibatis框架,使用jotm分布式事务控制,在运行过程中偶尔会出现异常,请高手指点。
spring配置文件:
<?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/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">
<!--指定Spring配置中用到的属性文件 -->
<bean id="propertyConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>WEB-INF/config/db/jdbc.properties</value>
<value>WEB-INF/config/db/webservice.properties</value>
<!-- <value>WEB-INF/config/db/cache.properties</value> -->
<!-- 类路径的写法 <value>classpath:com/dhc/epos/demo/conf/jdbc-demo.properties</value> -->
</list>
</property>
<property name="fileEncoding" value="UTF-8" />
</bean>
<!-- 分布式事务的配置方式 begin -->
<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean">
<property name="defaultTimeout" value="500000"/>
</bean>
<bean id="jtaTransactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="userTransaction" ref="jotm" />
</bean>
<bean id="dataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource"
destroy-method="close">
<property name="dataSource">
<bean class="org.enhydra.jdbc.standard.StandardXADataSource"
destroy-method="shutdown">
<property name="transactionManager" ref="jotm" />
<property name="driverName" value="${jdbc11.driverName}" />
<property name="url" value="${jdbc11.url}" />
<property name="user" value="${jdbc11.user}" />
<property name="password" value="${jdbc11.password}" />
</bean>
</property>
<property name="user" value="${jdbc11.user}" />
<property name="password" value="${jdbc11.password}" />
</bean>
<bean id="dataSourceBi" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource"
destroy-method="close">
<property name="dataSource">
<bean class="org.enhydra.jdbc.standard.StandardXADataSource"
destroy-method="shutdown">
<property name="transactionManager" ref="jotm" />
<property name="driverName" value="${jdbc6.driverName}" />
<property name="url" value="${jdbc6.url}" />
<property name="user" value="${jdbc6.user}" />
<property name="password" value="${jdbc6.password}" />
</bean>
</property>
<property name="user" value="${jdbc6.user}" />
<property name="password" value="${jdbc6.password}" />
</bean>
<bean id="dataSourceWms" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource"
destroy-method="close">
<property name="dataSource">
<bean class="org.enhydra.jdbc.standard.StandardXADataSource"
destroy-method="shutdown">
<property name="transactionManager" ref="jotm" />
<property name="driverName" value="${jdbc6.driverName}" />
<property name="url" value="${jdbc6.url}" />
<property name="user" value="${jdbc6.user}" />
<property name="password" value="${jdbc6.password}" />
</bean>
</property>
<property name="user" value="${jdbc6.user}" />
<property name="password" value="${jdbc6.password}" />
</bean>
<bean id="dataSourceCrm" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource"
destroy-method="close">
<property name="dataSource">
<bean class="org.enhydra.jdbc.standard.StandardXADataSource"
destroy-method="shutdown">
<property name="transactionManager" ref="jotm" />
<property name="driverName" value="${jdbc6.driverName}" />
<property name="url" value="${jdbc6.url}" />
<property name="user" value="${jdbc6.user}" />
<property name="password" value="${jdbc6.password}" />
</bean>
</property>
<property name="user" value="${jdbc6.user}" />
<property name="password" value="${jdbc6.password}" />
</bean>
<!-- 分布式事务的配置方式 end -->
<tx:advice id="txAdvice" transaction-manager="jtaTransactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="find*" read-only="true" />
<tx:method name="exclusive__*" propagation="REQUIRES_NEW" rollback-for="Exception"/>
<tx:method name="*" propagation="REQUIRED" rollback-for="Exception" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:advisor pointcut="execution(* *..as*..*(..))" advice-ref="txAdvice"/>
</aop:config>
<!-- 与数据库类型无关的序号生成器 end -->
<import resource="classpath:com/dhc/sms/*/conf/applicationContext*.xml" />
<import resource="classpath:com/dhc/sms/ifm/*/conf/applicationContext*.xml" />
异常信息:
exception in ReceiveVipLevelDaoImpl.doInsertVipLevelList; nested exception is org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in /com/dhc/sms/webservice/crm/points/dao/ibatis/maps/ifm_vip_level_temp_et.xml.
--- The error occurred while executing mapped statement.
--- Check the IfmVipLevelTem.insert.
--- Check the statement or the result map.
--- Cause: java.sql.SQLException: StandardXAConnectionHandle:prepareStatement should not be used outside an EJBServer; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in /com/dhc/sms/webservice/crm/points/dao/ibatis/maps/ifm_vip_level_temp_et.xml.
--- The error occurred while executing mapped statement.
--- Check the IfmVipLevelTem.insert.
--- Check the statement or the result map.
--- Cause: java.sql.SQLException: StandardXAConnectionHandle:prepareStatement should not be used outside an EJBServer