You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Jean-Louis Monteiro (Jira)" <ji...@apache.org> on 2022/01/19 10:18:00 UTC

[jira] [Commented] (TOMEE-3781) Tomee JTA rollback Failed

    [ https://issues.apache.org/jira/browse/TOMEE-3781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17478530#comment-17478530 ] 

Jean-Louis Monteiro commented on TOMEE-3781:
--------------------------------------------

Do you have a small github project where you can reproduce this?

> Tomee JTA rollback Failed
> -------------------------
>
>                 Key: TOMEE-3781
>                 URL: https://issues.apache.org/jira/browse/TOMEE-3781
>             Project: TomEE
>          Issue Type: Wish
>          Components: TomEE Build
>    Affects Versions: 8.0.6
>         Environment: tomee 8.0.6,jdk1.8
>            Reporter: zhi.li
>            Priority: Major
>
> Hello,recently I try to change an old javaee application's webserver.The Application is deploy to OC4J and JDK1.6.Now  we want to upgrade the JDK Version to 1.8,but oc4j don't support jdk 1.8.So wo had tried to change to tomcat.But we found that tomcat don't support JTA.Then I found tomee.But when i test the userTranscation.I found that  the trans can't rollback.I feel that Tomee server hold my failed trans,  the database(ORACLE) can't find these failed data.However i try to redo this trans in webpage,but it  failed because these data already exist in database.but we query these data in database again,wo don't find.When i stop the tomee server,these data can be found in database.
> In tomee.xml,i deploy the database config just like this: 
>  
> {code:java}
> <Resource id="jdbc/DataSource" type="DataSource">
>     jdbcDriver = oracle.jdbc.xa.client.OracleXADataSource
>     jtaManaged = true
>     initialPoolSize=30
>     maxPoolSize=50
>     jdbcUrl = 
>     password = 
>     userName = 
>   </Resource>
> {code}
> and in java  application,i use UserTranscation like this:
> {code:java}
> //Get UserTrans
> public static UserTransaction getUserTransaction() throws Exception {
>    try {
>       InitialContext context = new InitialContext();
>       return (UserTransaction) context
>             .lookup("java:comp/UserTransaction");
>    } catch (Exception e) {
>       throw new Exception("Error : lookup UserTransaction -- "
>             + e.getMessage());
>    }
> }
> //get conn
> conn = ServiceBean.getConnection();
> //...Query Some data use conn
> UserTransaction trans = null;
> try {
>   long startTime = System.currentTimeMillis();
>   trans = ServiceBean.getUserTransaction();
>   log.writeLog(6,
>                "transBegin[Start Time:" + new java.util.Date(startTime) +
>                "]");
>   trans.begin();
>  //...update to database
>   trans.commit();
> }catch(Exception ex){
>   trans.rollback();
> }
> {code}
> I debug these codes in Idea,and rollback is excuted.Please help to solve the problem.Thanks very much.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)