title: Configuring bitronix transaction manager on spring boot to connect oracle db
body: <p>I have configured bitronix as following : </p>
  
  <pre><code>   &lt;bean id="bitronixTMConfig" factory-method="getConfiguration" class="bitronix.tm.TransactionManagerServices"&gt;
           &lt;!-- Disabling Jmx avoids registering JMX Beans to any container --&gt;
           &lt;!-- &lt;property name="disableJmx" value="true" /&gt; --&gt;
           &lt;property name="serverId" value="request-handler-node" /&gt;
           &lt;property name="defaultTransactionTimeout" value="300" /&gt;
           &lt;!-- &lt;property name="logPart1Filename" value="C:\temp\bit-btm1.tlog" /&gt; --&gt;
           &lt;!-- &lt;property name="logPart2Filename" value="C:\temp\bit-btm2.tlog" /&gt; --&gt;
     &lt;/bean&gt;
  
     &lt;bean id="bitronixTM" factory-method="getTransactionManager" class="bitronix.tm.TransactionManagerServices" depends-on="bitronixTMConfig" /&gt;
  
     &lt;bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager" primary="true"&gt;
           &lt;property name="transactionManager" ref="bitronixTM" /&gt;
           &lt;property name="userTransaction" ref="bitronixTM" /&gt;
           &lt;property name="allowCustomIsolationLevels" value="true" /&gt;
     &lt;/bean&gt;
  
  &lt;bean id="applicationDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close"&gt;
           &lt;property name="uniqueName" value="applicationDataSource" /&gt;
           &lt;property name="className" value="oracle.jdbc.xa.client.OracleXADataSource" /&gt;
           &lt;property name="minPoolSize" value="${requestHandlerNode.repository.app.minPoolSize}" /&gt;
           &lt;property name="maxPoolSize" value="${requestHandlerNode.repository.app.maxPoolSize}" /&gt;
           &lt;property name="testQuery" value="SELECT 1 FROM DUAL" /&gt;
           &lt;property name="allowLocalTransactions" value="true" /&gt;
           &lt;property name="driverProperties"&gt;
                  &lt;props&gt;
                         &lt;prop key="user"&gt;${requestHandlerNode.repository.app.username}&lt;/prop&gt;
                         &lt;prop key="password"&gt;${requestHandlerNode.repository.app.password}&lt;/prop&gt;
                         &lt;prop key="URL"&gt;${requestHandlerNode.repository.app.url}&lt;/prop&gt;
                  &lt;/props&gt;
           &lt;/property&gt;
     &lt;/bean&gt;
  </code></pre>
  
  <p>and the pom dependencies :</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-batch&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-rest&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-jms&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-jta-bitronix&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.jms&lt;/groupId&gt;
          &lt;artifactId&gt;jms-api&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
          &lt;artifactId&gt;javax.transaction-api&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.codehaus.btm&lt;/groupId&gt;
          &lt;artifactId&gt;btm&lt;/artifactId&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
                  &lt;artifactId&gt;jta&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.oracle&lt;/groupId&gt;
          &lt;artifactId&gt;ojdbc6&lt;/artifactId&gt;
          &lt;version&gt;11.2.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;weblogic&lt;/groupId&gt;
          &lt;artifactId&gt;wlthint3client&lt;/artifactId&gt;
          &lt;version&gt;12.2.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>But on startup I receive this error :</p>
  
  <pre><code>Caused by: java.lang.IllegalStateException: cannot change the configuration while the transaction manager is running
  at bitronix.tm.Configuration.checkNotStarted(Configuration.java:699) ~[btm-2.1.4.jar:2.1.4]
  at bitronix.tm.Configuration.setLogPart1Filename(Configuration.java:166) ~[btm-2.1.4.jar:2.1.4]
  at org.springframework.boot.autoconfigure.transaction.jta.BitronixJtaConfiguration.bitronixConfiguration(BitronixJtaConfiguration.java:69) ~[spring-boot-autoconfigure-1.3.7.RELEASE.jar:1.3.7.RELEASE]
  at org.springframework.boot.autoconfigure.transaction.jta.BitronixJtaConfiguration$$EnhancerBySpringCGLIB$$a487082a.CGLIB$bitronixConfiguration$1(&lt;generated&gt;) ~[spring-boot-autoconfigure-1.3.7.RELEASE.jar:1.3.7.RELEASE]
  at org.springframework.boot.autoconfigure.transaction.jta.BitronixJtaConfiguration$$EnhancerBySpringCGLIB$$a487082a$$FastClassBySpringCGLIB$$c66fa53d.invoke(&lt;generated&gt;) ~[spring-boot-autoconfigure-1.3.7.RELEASE.jar:1.3.7.RELEASE]
  at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.2.5.RELEASE.jar:4.2.5.RELEASE]
  at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:355) ~[spring-context-4.2.5.RELEASE.jar:4.2.5.RELEASE]
  at org.springframework.boot.autoconfigure.transaction.jta.BitronixJtaConfiguration$$EnhancerBySpringCGLIB$$a487082a.bitronixConfiguration(&lt;generated&gt;) ~[spring-boot-autoconfigure-1.3.7.RELEASE.jar:1.3.7.RELEASE]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_77]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_77]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_77]
  at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_77]
  at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
  ... 19 common frames omitted
  </code></pre>
  
  <p>I suppose that the exception is due to the fact that spring boot and my application both initialize the bitronix transactionManager. </p>
  
  <p>How can I configure correctly bitronix with spring boot ?</p>
  
  <p>Thanks for the help.</p>