title: Major SQLException (XA related) in Weblogic application Server
body: <p>We're developing a software with Weblogic application server (12.1.1.0); We have one domain with two applications.</p>
  
  <p>We just moved up from development DB to pre-production DB (similar to production), and oh boy we got a major issue going...<br>
  DBA says the DBs are running the same version - Oracle 11 (I don't recall the exact version). The only difference we can see is that the dvlp DB uses SID for connection, and the other two uses service-name.</p>
  
  <p>Now, in our domain we have two data sources X and Y. Both are connected to the same DB. We use XA driver on both. Both our applications uses the same 'persistence.xml' (and entities) which has two PUs (persistence units), each using a different data source (X and Y).</p>
  
  <p>The problem is this:</p>
  
  <ol>
  <li>An MDB starts handling a request.</li>
  <li>It uses both PUs with EntityManagers and the Y data source with DataSource interface, which is used to get a connection (we have some JDBC code).</li>
  <li>It calls a bean from the other application.</li>
  <li>The other bean tries to use one of the PUs (the one connected to X data source).</li>
  <li><p>SQLException is thrown:</p>
  
  <p><code>XA error: XAResource.XAER_NOTA start() failed on resource 'x_my_domain': XAER_NOTA : The XID is not valid</code></p></li>
  </ol>
  
  <p>We've searched the error online and we found out that we should change the data sources' configuration to<br>
   <code>XASetTransactionTimeout=true</code><br>
   <code>XATransactionTimeout=0</code><br>
  but that didn't worked.</p>
  
  <p>We've also tried (a lot) to tweak the data sources' configuration, eventually removing one of them so we only need to tweak with only one of them, but nothing has worked.</p>
  
  <p>In addition, while repeatedly tweaking the configuration, a different SQLException has slipped under our radar and started popping out instead of the previous:  </p>
  
  <pre><code>Internal error: Cannot obtain XAConnection weblogic.common.resourcepool.ResourceDisabledException: Pool X is Suspended, cannot allocate resources to applications
  </code></pre>
  
  <p>Now this one is even more frustrating, because we tried everything; reset the data source; delete and re-create; delete and re-create with different name; delete the domain and re-create with a different data source name; go back using the dvlp DB; but nothing, the exception seems to persist.</p>
  
  <p>We really don't have any idea of how to solve this and we can't go any further without fixing this problem.</p>