吖了个挫啊,事务入口配置竟然无效,求大牛解答...小弟跪谢了../**
 * 不支持事务入口
 * 
 * @author YYY 2013-5-22
 * @see
 */
public abstract class UnSupportTransactionalProcessor<R extends RequestMessageBean<? extends RequestMessageHeaderBeanExtend, ? extends RequestMessageBodyBean>, RP extends ResponseMessageBean<? extends ResponseMessageHeaderBean, ? extends ResponseMessageBodyBean>>
extends MiddleProcessor<R, RP> {
@Transactional(readOnly = true)
public RP distribute(R message) throws Exception {
return super.process(message);
}
}
/**
 * 支持事务入口
 * 
 * @author YYY 2013-5-22
 * @see
 */
public abstract class SupportTransactionalProcessor<R extends RequestMessageBean<? extends RequestMessageHeaderBeanExtend, ? extends RequestMessageBodyBean>, RP extends ResponseMessageBean<? extends ResponseMessageHeaderBean, ? extends ResponseMessageBodyBean>>
extends MiddleProcessor<R, RP> {
@Transactional(readOnly = false, rollbackFor = Exception.class)
public RP distribute(R message) throws Exception {
return super.process(message);
}
}XML配置文件:
<?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:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
                        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
                        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
                        http://www.springframework.org/schema/jee http://http://www.springframework.org/schema/jee/spring-jee-2.5.xsd"> <!-- 预加载JDBC配置  -->
<bean id="propertyConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
</bean> <bean id="dataSourcePublic" class="com.atomikos.jdbc.AtomikosDataSourceBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="mysql/dataSourcePublic" />
<property name="minPoolSize" value="3" />
<property name="maxPoolSize" value="15" />
<property name="xaDataSourceClassName" value="${XA_MYSQL_DRIVER_NAME}" />
<property name="xaProperties">
<props>
<prop key="URL">${PUBLIC_DRIVER_URL}</prop>
<prop key="user">${PUBLIC_USER_NAME}</prop>
<prop key="password">${PUBLIC_USER_PASS}</prop>
</props>
</property>
</bean> <bean id="dataSourceChildNode0" class="com.atomikos.jdbc.AtomikosDataSourceBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="mysql/dataSourceChildNode0" />
<property name="minPoolSize" value="3" />
<property name="maxPoolSize" value="15" />
<property name="xaDataSourceClassName" value="${XA_MYSQL_DRIVER_NAME}" />
<property name="xaProperties">
<props>
<prop key="URL">${NODE0_DRIVER_URL}</prop>
<prop key="user">${NODE0_USER_NAME}</prop>
<prop key="password">${NODE0_USER_PASS}</prop>
</props>
</property>
</bean> <bean id="dataSourceChildNode1" class="com.atomikos.jdbc.AtomikosDataSourceBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="mysql/dataSourceChildNode1" />
<property name="minPoolSize" value="3" />
<property name="maxPoolSize" value="15" />
<property name="xaDataSourceClassName" value="${XA_MYSQL_DRIVER_NAME}" />
<property name="xaProperties">
<props>
<prop key="URL">${NODE1_DRIVER_URL}</prop>
<prop key="user">${NODE1_USER_NAME}</prop>
<prop key="password">${NODE1_USER_PASS}</prop>
</props>
</property>
</bean> <bean id="dataSourceChildNode2" class="com.atomikos.jdbc.AtomikosDataSourceBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="mysql/dataSourceChildNode2" />
<property name="minPoolSize" value="3" />
<property name="maxPoolSize" value="15" />
<property name="xaDataSourceClassName" value="${XA_MYSQL_DRIVER_NAME}" />
<property name="xaProperties">
<props>
<prop key="URL">${NODE2_DRIVER_URL}</prop>
<prop key="user">${NODE2_USER_NAME}</prop>
<prop key="password">${NODE2_USER_PASS}</prop>
</props>
</property>
</bean> <bean id="dataSourceChildNode3" class="com.atomikos.jdbc.AtomikosDataSourceBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="mysql/dataSourceChildNode3" />
<property name="minPoolSize" value="3" />
<property name="maxPoolSize" value="15" />
<property name="xaDataSourceClassName" value="${XA_MYSQL_DRIVER_NAME}" />
<property name="xaProperties">
<props>
<prop key="URL">${NODE3_DRIVER_URL}</prop>
<prop key="user">${NODE3_USER_NAME}</prop>
<prop key="password">${NODE3_USER_PASS}</prop>
</props>
</property>
</bean> <bean id="dataSourceChildNode4" class="com.atomikos.jdbc.AtomikosDataSourceBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="mysql/dataSourceChildNode4" />
<property name="minPoolSize" value="3" />
<property name="maxPoolSize" value="15" />
<property name="xaDataSourceClassName" value="${XA_MYSQL_DRIVER_NAME}" />
<property name="xaProperties">
<props>
<prop key="URL">${NODE4_DRIVER_URL}</prop>
<prop key="user">${NODE4_USER_NAME}</prop>
<prop key="password">${NODE4_USER_PASS}</prop>
</props>
</property>
</bean> <bean id="dataSourceChildNode5" class="com.atomikos.jdbc.AtomikosDataSourceBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="mysql/dataSourceChildNode5" />
<property name="minPoolSize" value="3" />
<property name="maxPoolSize" value="15" />
<property name="xaDataSourceClassName" value="${XA_MYSQL_DRIVER_NAME}" />
<property name="xaProperties">
<props>
<prop key="URL">${NODE5_DRIVER_URL}</prop>
<prop key="user">${NODE5_USER_NAME}</prop>
<prop key="password">${NODE5_USER_PASS}</prop>
</props>
</property>
</bean> <bean id="dataSourceChildNode6" class="com.atomikos.jdbc.AtomikosDataSourceBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="mysql/dataSourceChildNode6" />
<property name="minPoolSize" value="3" />
<property name="maxPoolSize" value="15" />
<property name="xaDataSourceClassName" value="${XA_MYSQL_DRIVER_NAME}" />
<property name="xaProperties">
<props>
<prop key="URL">${NODE6_DRIVER_URL}</prop>
<prop key="user">${NODE6_USER_NAME}</prop>
<prop key="password">${NODE6_USER_PASS}</prop>
</props>
</property>
</bean> <bean id="dataSourceNode"
class="com.richinfo.spis.persistence.abs.resolver.DynamicDataSource">
<property name="targetDataSources">
<map key-type="java.lang.String">
<entry key="node0" value-ref="dataSourceChildNode0" />
<entry key="node1" value-ref="dataSourceChildNode1" />
<entry key="node2" value-ref="dataSourceChildNode2" />
<entry key="node3" value-ref="dataSourceChildNode3" />
<entry key="node4" value-ref="dataSourceChildNode4" />
<entry key="node5" value-ref="dataSourceChildNode5" />
<entry key="node6" value-ref="dataSourceChildNode6" />

</map>
</property>
<property name="defaultTargetDataSource" ref="dataSourceChildNode0" />
</bean> <bean id="sqlMapClientPublic" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocations">
<list>
<value>
classpath:xxx
</value>
<value>
classpath:xxx
</value>
</list>
</property>
<property name="dataSource">
<ref local="dataSourcePublic" />
</property>
</bean> <bean id="sqlMapClientNode" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocations">
<list>
<value>
classpath:xxx
</value>
<value>
classpath:xxx
</value>
</list>
</property>
<property name="dataSource">
<ref local="dataSourceNode" />
</property>
</bean> <bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
init-method="init" destroy-method="close">
<property name="forceShutdown">
<value>true</value>
</property>
</bean> <bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp">
<property name="transactionTimeout" value="300" />
</bean> <!-- Spring JTA事务管理器 -->
<bean id="jtaTransactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager">
<ref bean="atomikosTransactionManager" />
</property>
<property name="userTransaction">
<ref bean="atomikosUserTransaction" />
</property>
<property name="allowCustomIsolationLevels" value="true" />
</bean>
<!-- Annotation 管理事务 -->
<tx:annotation-driven transaction-manager="jtaTransactionManager" />
        <context:component-scan base-package="xxxx">
<context:include-filter type="regex" expression=".logic..*" />
<context:exclude-filter type="regex" expression=".logic.entity..*"/>
<context:exclude-filter type="regex" expression=".logic.task..*"/>
</context:component-scan>
        <!-- 扫描DAO层支持 -->
<context:component-scan base-package="xxxx">
<context:include-filter type="annotation"
expression="com.richinfo.spis.persistence.abs.annotation.DaoAlias" />
<context:include-filter type="regex"
expression="com.richinfo.spis.persistence.extend.dao..*.impl.*Impl" />
</context:component-scan>
</beans>通过开启DEBUG日志,发现两入口没起作用,急....atomikosjava事务springtransactional