JTA 中的更新语句在发生超时和日志中的回滚状态后提交

update statement in JTA is committed after timeout happens and rollback status in logs

我正在 weblogic 中模拟一个场景,以查看 jta 在我们的项目中如何使用 spring 4。 意识到如果发生事务超时,我在这个事务边界中的应用程序更新语句仍然很有趣。

仿真逻辑是;在像 TOAD 一样的单独应用程序中获取行锁,在应用程序中发生事务超时后释放锁并在 TOAD 中提交,并期望应用程序端也回滚。

发生的事情是应用程序根据日志回滚,但在数据库中更新已提交。

使用 weblogic 数据源,全局事务被禁用。 jdbc class 是: oracle.jdbc.OracleDriver

config.xml

<tx:annotation-driven/>

<jee:jndi-lookup id="dataSource" jndi-name="jdbc/UNICA_TCODS_NONXA"/>

<bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager" />

config.java :

@EnableTransactionManagement
@Configuration
public class AppConfig {

    @Autowired
    DataSource dataSource;

    @Bean
    public GetInterestListServiceImpl getInterestListService() {
        return new GetInterestListServiceImpl(dataSource);
    }

}

服务就像:

@Service("GetInterestListService")
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public class GetInterestListServiceImpl implements GetInterestListService {

    private static final Logger logger = MnSLogger.getLogger(GetInterestListServiceImpl.class.getName());

    private DataSource dataSource;

    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;

    public GetInterestListServiceImpl(DataSource dataSource) {
        this.dataSource = dataSource;
        JdbcTemplate template = new JdbcTemplate(dataSource);
        this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(template);
    }

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor=Exception.class)
    @Override
    public GetInterestListResponse getInterestList(String clientTID,String ffid, String lang) {

        SqlParameterSource namedParametersForGetCampaign = new MapSqlParameterSource("s", lang);
        String sqll = "UPDATE "+ffid+" CSB SET IMAGE_URL_TR=:s";
        System.out.println("sqll = " + sqll); 
        int rowCount = this.namedParameterJdbcTemplate.update(sqll, namedParametersForGetCampaign);

        System.out.println("rowCount = " + rowCount);

按时间顺序排列的日志如下:

5.27.50 -- 蟾蜍

首先,向这个 table 发送一个更新语句,并在没有提交的情况下等待,故意让应用程序等待 sql: 更新锁 1 SET IMAGE_URL_TR='www.google.com.tr';

5.28.04 -- APP

在应用端调用服务启动交易

5.28.04 -- APP交易开始。

####<Dec 29, 2018 5:28:04 PM EET> <Debug> <JTA2PC> <uatosb01v> <<anonymous>> <> <> <1546093684026> <BEA-000000> <java.lang.Exception: DEBUG: Xid=BEA1-001D812805B0(882519654),Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds left=-1546093684) wakeUpAfterSeconds(30)
    at weblogic.transaction.internal.TxDebug.debugStack(TxDebug.java:60)
    at weblogic.transaction.internal.TransactionImpl.wakeUpAfterSeconds(TransactionImpl.java:2015)
    at weblogic.transaction.internal.TransactionImpl.init(TransactionImpl.java:279)
    at weblogic.transaction.internal.TransactionImpl.<init>(TransactionImpl.java:254)
    at weblogic.transaction.internal.ServerTransactionImpl.<init>(ServerTransactionImpl.java:196)
    at weblogic.transaction.internal.ServerTransactionManagerImpl.createTransaction(ServerTransactionManagerImpl.java:2022)
    at weblogic.transaction.internal.ServerTransactionManagerImpl.createTransaction(ServerTransactionManagerImpl.java:2004)
    at weblogic.transaction.internal.TransactionManagerImpl.internalBegin(TransactionManagerImpl.java:254)
    at weblogic.transaction.internal.ServerTransactionManagerImpl.internalBegin(ServerTransactionManagerImpl.java:360)
    at weblogic.transaction.internal.ServerTransactionManagerImpl.begin(ServerTransactionManagerImpl.java:335)
    at weblogic.transaction.internal.TransactionManagerImpl.internalBegin(TransactionManagerImpl.java:223)
    at weblogic.transaction.internal.TransactionManagerImpl.begin(TransactionManagerImpl.java:186)
    at org.springframework.transaction.jta.JtaTransactionManager.doJtaBegin(JtaTransactionManager.java:874)
    at org.springframework.transaction.jta.JtaTransactionManager.doBegin(JtaTransactionManager.java:831)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:447)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:277)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
    at com.sun.proxy.$Proxy216.getInterestList(Unknown Source)
    at com.xyz1.crm.unicamobilegateway.controller.UnicaMobileGatewayRestController.getInterestList(UnicaMobileGatewayRestController.java:111)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:184)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3732)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

5.28.04 -- APP

开始尝试运行声明。

####<Dec 29, 2018 5:28:04 PM EET> <Debug> <JDBCInternal> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093684040> <BEA-000000> < > CE:getCS (10) isCallable = false, sql = UPDATE LOCK1 CSB SET IMAGE_URL_TR=?, resultSetType = -1, resultSetConcurrency = -1, resultSetHoldability = -1, autoGeneratedKeys = -1, columnIndexes = null, columnNames = null>
####<Dec 29, 2018 5:28:04 PM EET> <Debug> <JDBCInternal> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093684040> <BEA-000000> <  CE:getCS (25) key = false:UPDATE LOCK1 CSB SET IMAGE_URL_TR=?:-1:-1:-1:-1:null:null>
####<Dec 29, 2018 5:28:04 PM EET> <Debug> <JDBCInternal> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093684040> <BEA-000000> <  CE:getCS (30) entry = weblogic.jdbc.common.internal.StatementHolder@6423995f>
####<Dec 29, 2018 5:28:04 PM EET> <Debug> <JDBCInternal> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093684040> <BEA-000000> <<  CE:getCS (100.2) entry = weblogic.jdbc.common.internal.StatementHolder@6423995f>

5.28.38 --APP

因为 JTA 超时是 30,我可以看到事务回滚

####<Dec 29, 2018 5:28:38 PM EET>  <JTA2PC> <uatosb01v> <sideAppServer1> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1546093718444> <BEA-000000> <java.lang.Exception: DEBUG: Xid=BEA1-001D812805B0(882519654),Status=Active,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=34,seconds left=-4,activeThread=Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads],SCInfo[xyzdomain+sideAppServer1]=(state=active),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=sideAppServer1+192.168.244.76:10004+xyzdomain+t3+, XAResources={WSATGatewayRM_sideAppServer1_xyzdomain},NonXAResources={})]) wakeUpAfterSeconds(30)
        at weblogic.transaction.internal.TxDebug.debugStack(TxDebug.java:60)
        at weblogic.transaction.internal.TransactionImpl.wakeUpAfterSeconds(TransactionImpl.java:2015)
        at weblogic.transaction.internal.ServerTransactionImpl.wakeUp(ServerTransactionImpl.java:1772)
        at weblogic.transaction.internal.ServerTransactionManagerImpl.processTimedOutTransactions(ServerTransactionManagerImpl.java:1676)
        at weblogic.transaction.internal.TransactionManagerImpl.wakeUp(TransactionManagerImpl.java:1988)
        at weblogic.transaction.internal.ServerTransactionManagerImpl.wakeUp(ServerTransactionManagerImpl.java:1586)
        at weblogic.transaction.internal.WLSTimer.timerExpired(WLSTimer.java:35)
        at weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
>
####<Dec 29, 2018 5:28:38 PM EET>  <JTA2PC> <uatosb01v> <sideAppServer1> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1546093718444> <BEA-000000> <java.lang.Exception: DEBUG: Xid=BEA1-001D812805B0(882519654),Status=Marked rollback. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 34 seconds
BEA1-001D812805B0],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=34,seconds left=30,activeThread=Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads],SCInfo[xyzdomain+sideAppServer1]=(state=active),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=sideAppServer1+192.168.244.76:10004+xyzdomain+t3+, XAResources={WSATGatewayRM_sideAppServer1_xyzdomain},NonXAResources={})]) wakeUpAfterSeconds(30)
>
####<Dec 29, 2018 5:28:38 PM EET>  <JTA2PC> <uatosb01v> <sideAppServer1> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1546093718445> <BEA-000000> <java.lang.Exception: DEBUG: Xid=BEA1-001D812805B0(882519654),Status=Marked rollback. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 34 seconds
BEA1-001D812805B0],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=34,seconds left=30,activeThread=Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads],SCInfo[xyzdomain+sideAppServer1]=(state=active),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=sideAppServer1+192.168.244.76:10004+xyzdomain+t3+, XAResources={WSATGatewayRM_sideAppServer1_xyzdomain},NonXAResources={})]) wakeUpAfterSeconds(10)
>
####<Dec 29, 2018 5:28:48 PM EET>  <JTA2PC> <uatosb01v> <sideAppServer1> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1546093728448> <BEA-000000> <wakeUp runing: Xid=BEA1-001D812805B0(882519654),Status=Marked rollback. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 34 seconds
BEA1-001D812805B0],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=44,seconds left=0,activeThread=Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads],SCInfo[xyzdomain+sideAppServer1]=(state=active),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=sideAppServer1+192.168.244.76:10004+xyzdomain+t3+, XAResources={WSATGatewayRM_sideAppServer1_xyzdomain},NonXAResources={})])>
####<Dec 29, 2018 5:28:48 PM EET>  <JTA2PC> <uatosb01v> <sideAppServer1> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1546093728448> <BEA-000000> <java.lang.Exception: DEBUG: Xid=BEA1-001D812805B0(882519654),Status=Marked rollback. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 34 seconds
BEA1-001D812805B0],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=44,seconds left=0,activeThread=Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads],SCInfo[xyzdomain+sideAppServer1]=(state=active),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=sideAppServer1+192.168.244.76:10004+xyzdomain+t3+, XAResources={WSATGatewayRM_sideAppServer1_xyzdomain},NonXAResources={})]) wakeUpAfterSeconds(30)
>
####<Dec 29, 2018 5:28:48 PM EET>  <JTA2PC> <uatosb01v> <sideAppServer1> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1546093728449> <BEA-000000> <BEA1-001D812805B0: null: ServerTransactionImpl.globalRollback()>
####<Dec 29, 2018 5:28:48 PM EET>  <JTA2PC> <uatosb01v> <sideAppServer1> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1546093728449> <BEA-000000> <BEA1-001D812805B0: null: TX[BEA1-001D812805B0] active-->rolling back
java.lang.Exception: DEBUG
>
####<Dec 29, 2018 5:28:48 PM EET>  <JTA2PC> <uatosb01v> <sideAppServer1> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1546093728449> <BEA-000000> <ServerSCInfo.startRollback: Xid=BEA1-001D812805B0(882519654),Status=Rolling Back. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 34 seconds
BEA1-001D812805B0],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=44,seconds left=30,activeThread=Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads],SCInfo[xyzdomain+sideAppServer1]=(state=active),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=sideAppServer1+192.168.244.76:10004+xyzdomain+t3+, XAResources={WSATGatewayRM_sideAppServer1_xyzdomain},NonXAResources={})])>
####<Dec 29, 2018 5:28:48 PM EET>  <JTA2PC> <uatosb01v> <sideAppServer1> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1546093728449> <BEA-000000> <SC[xyzdomain+sideAppServer1] active-->rolledback
java.lang.Exception: DEBUG
>
####<Dec 29, 2018 5:28:48 PM EET>  <JTA2PC> <uatosb01v> <sideAppServer1> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1546093728449> <BEA-000000> <BEA1-001D812805B0: null: TX[BEA1-001D812805B0] rolling back-->rolled back
java.lang.Exception: DEBUG
>
####<Dec 29, 2018 5:28:48 PM EET>  <JTA2PC> <uatosb01v> <sideAppServer1> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1546093728449> <BEA-000000> <BEA1-001D812805B0: null: releaseLog>

5:29:31 --APP

在 TOAD 中提交事务以推进应用程序语句 通过提交释放 TOAD 事务后,应用程序还尝试 运行 更新。最有趣的是下面的更新语句正在使用事务 "BEA1-001D812805B0" 来执行最近回滚的语句。

####<Dec 29, 2018 5:29:31 PM EET> <Debug> <JDBCSQL> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093771924> <BEA-000000> <[weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_OraclePreparedStatementWrapper@3b] executeUpdate returns 7>
####<Dec 29, 2018 5:29:31 PM EET> <Debug> <JDBCSQL> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093771925> <BEA-000000> <[weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_OraclePreparedStatementWrapper@3b] getWarnings()>
####<Dec 29, 2018 5:29:31 PM EET> <Debug> <JDBCSQL> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093771925> <BEA-000000> <[weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_OraclePreparedStatementWrapper@3b] getWarnings returns>
####<Dec 29, 2018 5:29:31 PM EET> <Debug> <JDBCSQL> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093771927> <BEA-000000> <[weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_OraclePreparedStatementWrapper@3b] close()>
####<Dec 29, 2018 5:29:31 PM EET> <Debug> <JDBCInternal> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093771927> <BEA-000000> < > CE:retCS (10) entry = weblogic.jdbc.common.internal.StatementHolder@6423995f>
####<Dec 29, 2018 5:29:31 PM EET> <Debug> <JDBCInternal> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093771927> <BEA-000000> <  CE:retCS (20) key = false:UPDATE LOCK1 CSB SET IMAGE_URL_TR=?:-1:-1:-1:-1:null:null>
####<Dec 29, 2018 5:29:31 PM EET> <Debug> <JDBCInternal> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093771927> <BEA-000000> < < CE:retCS (100) >
####<Dec 29, 2018 5:29:31 PM EET> <Debug> <JDBCSQL> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093771928> <BEA-000000> <[weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_OraclePreparedStatementWrapper@3b] close returns>
####<Dec 29, 2018 5:29:31 PM EET> <Debug> <JDBCSQL> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093771928> <BEA-000000> <[weblogic.jdbc.wrapper.PoolConnection_oracle_jdbc_driver_T4CConnection@3a] close()>
####<Dec 29, 2018 5:29:31 PM EET> <Debug> <JDBCConn> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093771928> <BEA-000000> <ConnectionEnv.cleanup, jconn=oracle.jdbc.driver.T4CConnection@2bc8d34, isXA=false, isJTS=false, jconn.isolationLevel=2, initialIsolationLevel=2, dirtyIsolationLevel=false>
####<Dec 29, 2018 5:29:31 PM EET> <Debug> <JDBCSQL> <uatosb01v> <<anonymous>> <BEA1-001D812805B0> <> <1546093771929> <BEA-000000> <[weblogic.jdbc.wrapper.PoolConnection_oracle_jdbc_driver_T4CConnection@3a] close returns>

weblogic.out

17.28.04

2018-12-29 17:28:04,025 DEBUG [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] support.AbstractPlatformTransactionManager (AbstractPlatformTransactionManager.java:367) - Creating new transaction with name [com.xyz1.crm.unicamobilegateway.service.impl.GetInterestListServiceImpl.getInterestList]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '',-java.lang.Exception
sqll = UPDATE LOCK1 CSB SET IMAGE_URL_TR=:s

17:29:31

rowCount = 7
2018-12-29 17:29:31,929 DEBUG [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] support.AbstractPlatformTransactionManager (AbstractPlatformTransactionManager.java:759) - Initiating transaction commit
org.springframework.transaction.UnexpectedRollbackException: JTA transaction already rolled back (probably due to a timeout)
        at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1021)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:504)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:292)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
        at com.sun.proxy.$Proxy216.getInterestList(Unknown Source)

经过多次场景测试和调试。从头开始安装新的 weblogic 10.3.6 (11g),我发现 weblogic 有问题。

如果有一个 xa 数据源,那么 weblogic 可以在 JTA 事务中管理这个数据源。 如果有本地数据源,无论是否支持任何选项的全局事务,weblogic 都无法在 JTA 中管理数据源事务。

存在 weblogic JTA 事务管理器问题。