Note that there are some explanatory texts on larger screens.

plurals
  1. POClient's Transaction Aborted when accessing two databases
    primarykey
    data
    text
    <p>I have a propertiesbean which gives me SqlSessions. This bean is annotated with all this jazz @ the class level</p> <pre><code>@Singleton @LocalBean @Startup @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) </code></pre> <p>i also have this</p> <pre><code>public SqlSessionFactory getSqlSessionFactory(ConnTypes connType) {...} </code></pre> <p>which returns the SqlSession you want.</p> <p>I have two databases. One is a mysql instance and the other one isn't (lets call it db2). </p> <p>When I run the project locally everything is fine. Both databases are accessed with no problem.</p> <p>When I run the project on our test server it starts to throw a Client Transaction aborted error. I've done a fair amount of research on this and it seems like people get these exceptions when there is a problem with a database query or some database access. The entire transaction is then marked as rollback and this exception is thrown (at least that's what i've read)</p> <p>It looks to me like it throws an XA-Resource error right before the first time it throws the client's transaction aborted error. I know that you can get those when your bean tries to access another session. I've seen this error before when running locally and trying to maintain connections to both databases in one method. </p> <p>Could it be that my singleton properties bean, which accesses both databases, gets into a weird transactional state trying to return a mysql session in one thread and a db2 session in the other?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload