title: java.sql.SQLException: Unable to obtain lock in 60 seconds
body: <p>I'm tracking this error for a while now, it hapens on irregular basis unpredictibly and I haven't find a way to reproduce it for now.</p>
  
  <p>Our environment </p>
  
  <ul>
  <li>linux centos 5.3 hosting one jboss 5.1 app server</li>
  <li>linux centos 5.3 hosting one oracle 10g XE db</li>
  <li>windows server 2003 R2 hosting another oracle 10g XE db </li>
  </ul>
  
  <p>Programming environment</p>
  
  <ul>
  <li>seam 2.1</li>
  <li>hibernate </li>
  <li>JSF 1.2</li>
  </ul>
  
  <p>Most of this errors happens on a "APPLICATION" scope seam component, but it also happened elswhere.</p>
  
  <p>Wea are using XA-datasource to access the databases.</p>
  
  <p>It appeares that tis is also some sort of a bug in jboss 5.1 <a href="http://community.jboss.org/thread/65702" rel="nofollow">look here</a>, but we do not have  queries or requests that last 60 seconds.</p>
  
  <p>What could be the possible reason for this kind of errors?</p>
  
  <p>The final stack trace of the error: </p>
  
  <pre><code>Caused by: java.sql.SQLException: Unable to obtain lock in 60 seconds: org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@1d314d
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.tryLock(BaseWrapperManagedConnection.java:267)
      at org.jboss.resource.adapter.jdbc.WrappedConnection.lock(WrappedConnection.java:79)
      at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:237)
      at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
      at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
      at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
      at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1573)
      at org.hibernate.loader.Loader.doQuery(Loader.java:696)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
      at org.hibernate.loader.Loader.doList(Loader.java:2228)
  </code></pre>