Announcement Announcement Module
Collapse
No announcement yet.
SQL operations are not allowed with no global transaction Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SQL operations are not allowed with no global transaction

    We are using a XA driver for our applications. The transactions are committed to the database. But after that we get the following error. We use Weblogic 8.1 and we have not enabled "Support Local Transactions" for the XA connection pool. Is there any other way to solve this other than checking the checkbox "Support Local Transaction"

    Code:
    java.sql.SQLException: SQL operations are not allowed with no global transaction by default for XA drivers. If the XA driver supports performing SQL operations with no global transaction, explicitly allow it by setting "SupportsLocalTransaction" JDBC connection pool property to true. In this case, also remember to complete the local transaction before using the connection again for global transaction, else a XAER_OUTSIDE XAException may result. To complete a local transaction, you can either set auto commit to true or call Connection.commit() or Connection.rollback().
                at weblogic.jdbc.wrapper.JTAConnection.checkIfLocalTxSupported(JTAConnection.java:90)
                at weblogic.jdbc.wrapper.JTAConnection.checkConnection(JTAConnection.java:79)
                at weblogic.jdbc.wrapper.Connection.preInvocationHandler(Connection.java:70)
                at weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_OracleConnection.getWarnings(Unknown Source)
                at org.hibernate.jdbc.AbstractBatcher.closeConnection(AbstractBatcher.java:433)
                at org.hibernate.jdbc.JDBCContext.disconnect(JDBCContext.java:173)
                at org.hibernate.jdbc.JDBCContext.release(JDBCContext.java:81)
                at org.hibernate.impl.SessionImpl.close(SessionImpl.java:266)
                at org.springframework.orm.hibernate3.SessionFactoryUtils.doClose(SessionFactoryUtils.java:736)
                at org.springframework.orm.hibernate3.SessionFactoryUtils.closeSessionOrRegisterDeferredClose(SessionFactoryUtils.java:725)
                at org.springframework.orm.hibernate3.SessionFactoryUtils.access$300(SessionFactoryUtils.java:87)
                at org.springframework.orm.hibernate3.SessionFactoryUtils$SpringSessionSynchronization.afterCompletion(SessionFactoryUtils.java:906)
                at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCompletion(AbstractPlatformTransactionManager.java:576)
                at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:433)
                at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:256)
                at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:67)
                at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
                at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
                at $Proxy12.getAccountDetails(Unknown Source)
                at be.telenet.revenu.bilweb.webclient.delegate.AccountDelegate.getDetails(AccountDelegate.java:57)
                at be.telenet.revenu.bilweb.webclient.action.AccountSearchAction.getDetails(AccountSearchAction.java:64)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:324)
                at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
                at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
                at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
                at com.sourcebeat.strutslive.common.PojoRequestProcessor.process(PojoRequestProcessor.java:103)
                at be.telenet.bos.presentation.processor.RequestHandler.process(RequestHandler.java:90)
                at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
                at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
                at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
                at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
                at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
                at be.telenet.revenu.bilweb.webclient.filter.SignOnFilter.doFilter(SignOnFilter.java:33)
                at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
                at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6356)
                at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
                at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
                at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
                at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
                at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
                at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

  • #2
    I'm just getting back to doing XA stuff after playing with it a while back, so my memory might be hazy...

    If I remember correctly, yes, you have to check that box if you want to use an XA datasource in a non-JTA transaction. I believe Spring will call commit() for you to complete the transaction if it determines that there is no ongoing JTA transaction.

    But is this what you are doing? Is this exception occurring while using an XA datasource to complete an operation that is not managed by a JTA transaction manager? If the answer is yes, then a potential solution is to configure an non-XA datasource and use that in those cases where no distributed transaction is required, this avoiding this error.

    On the other hand, if you really are executing a SQL operation that is managed by a TransactionProxyFactoryBean configured with a JTA transaction manager, then it would appear that something else is going on; I wouldn't expect that error message. Perhaps hibernate needs configured with the appropriate transaction manager?

    Maybe posting your Spring configuration files would help.

    Tim

    Comment


    • #3
      We are doing a JTA-transaction. The error occurs after the commit has been issued and the connection is being returned back to the pool. The transaction gets committed properly. No issues in that. But when the connection has to be released, we get this error. that means the XA connection is being closed after the transaction has been committed.

      I am posting the application-context we are using.

      Code:
      <beans>
      
          <bean id="appDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
              <property name="jndiName">
                  <value>bosDemoApplication</value>
              </property>
          </bean>
      
          <bean id="appSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
              <property name="mappingJarLocations">
                  <list>
                      <value>AccountMgmtClient.jar</value>
                  </list>
              </property>
      
              <property name="hibernateProperties">
                  <props>
                      <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
                      <prop key="hibernate.show_sql">true</prop>
                  </props>
              </property>
              <property name="dataSource">
                  <ref bean="appDataSource"/>
              </property>
          </bean>
      
          <bean id="hibernateDaoImpl" class="be.telenet.bos.persistence.dao.hibernate.HibernateDataAccessObject">
              <property name="sessionFactory">
                  <ref bean="appSessionFactory"/>
              </property>
          </bean>
      
          <bean id="hibernateDao" class="org.springframework.aop.framework.ProxyFactoryBean">
              <property name="proxyInterfaces">
                  <value>be.telenet.bos.persistence.dao.DataAccessObject</value>
              </property>
              <property name="interceptorNames">
                  <list>
                      <value>hibernateDaoImpl</value>
                  </list>
              </property>
          </bean>
      
          <bean id="appTransactionManager"
              class="org.springframework.transaction.jta.WebLogicJtaTransactionManager">
          </bean>
      
          <bean id="AccountDetailsBusinessServiceTarget" class="be.telenet.revenu.accountdetails.AccountDetailsBusinessServiceProvider">
      
          </bean>
      
          <bean id="AccountDetailsBusinessService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
              <property name="target">
                  <ref bean="AccountDetailsBusinessServiceTarget"/>
              </property>
      
              <property name="transactionManager">
                  <ref bean="appTransactionManager"/>
              </property>
      
              <property name="transactionAttributes">
                  <props>
                      <prop key="*">PROPAGATION_REQUIRED</prop>
                  </props>
              </property>
          </bean>
      </beans>

      Comment

      Working...
      X