title: Hibernate error : Could not turn on auto-commit in an active global transaction
body: <p>I'm getting an error while deploying our application. <br/></p>
  
  <p>The environmet is : </p>
  
  <ul>
  <li>Jboss 7.1.3+Hibernate 4 + JPA </li>
  <li>OJDBC : ojdbc6.jar </li>
  </ul>
  
  <p>The stacktrace is as below,</p>
  
  <pre><code>09:13:30,703 WARN  [org.hibernate.engine.jdbc.internal.JdbcServicesImpl] (ServerService Thread Pool -- 127) HHH000341: Could not obtain connection metadata : could not turn on auto-commit in an active global transaction
  09:13:30,703 INFO  [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (ServerService Thread Pool -- 127) HHH000422: Disabling contextual LOB creation as connection was null
  09:13:30,704 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 127) MSC00001: Failed to start service jboss.persistenceunit."css-ear-0.5.3-SIT.ear/css-submission-0.5.3-SIT.war#css-submission-PU": org.jboss.msc.service.StartException in service jboss.persistenceunit."css-ear-0.5.3-SIT.ear/css-submission-0.5.3-SIT.war#css-submission-PU": java.lang.NullPointerException
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:100) [jboss-as-jpa-7.1.3.Final.jar:7.1.3.Final]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]
      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]
      at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]
  Caused by: java.lang.NullPointerException
      at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:207)
      at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
      at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:73)
      at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2279)
      at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2275)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1744)
      at org.hibernate.ejb.EntityManagerFactoryImpl.&lt;init&gt;(EntityManagerFactoryImpl.java:94)
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:197) [jboss-as-jpa-7.1.3.Final.jar:7.1.3.Final]
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$500(PersistenceUnitServiceImpl.java:57) [jboss-as-jpa-7.1.3.Final.jar:7.1.3.Final]
      at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:96) [jboss-as-jpa-7.1.3.Final.jar:7.1.3.Final
  </code></pre>
  
  <p>The datasource configuration in standalone.xml is,</p>
  
  <pre><code>&lt;xa-datasource jta="true" jndi-name="java:jboss/datasources/PsaDS" pool-name="PsaDS" enabled="true" use-java-context="true" use-ccm="true"&gt;
    &lt;xa-datasource-property name="URL"&gt;
          jdbc:oracle:thin:@&lt;hsot&gt;
    &lt;/xa-datasource-property&gt;
    &lt;driver&gt;oracle&lt;/driver&gt;
    &lt;transaction-isolation&gt;TRANSACTION_READ_COMMITTED&lt;/transaction-isolation&gt;
    &lt;xa-pool&gt;
          &lt;min-pool-size&gt;2&lt;/min-pool-size&gt;
          &lt;max-pool-size&gt;50&lt;/max-pool-size&gt;
          &lt;prefill&gt;true&lt;/prefill&gt;
    &lt;/xa-pool&gt;
    &lt;security&gt;
          &lt;user-name&gt;user&lt;/user-name&gt;
          &lt;password&gt;pwd&lt;/password&gt;
    &lt;/security&gt;
  </code></pre>
  
  <p></p>
  
  <p>The driver we are using is,</p>
  
  <pre><code>&lt;drivers&gt;
    &lt;driver name="oracle" module="com.oracle.ojdbc6"&gt;
          &lt;xa-datasource-class&gt;oracle.jdbc.xa.client.OracleXADataSource&lt;/xa-datasource-class&gt;
    &lt;/driver&gt;&lt;/drivers&gt;
  </code></pre>