6 Replies Latest reply on Jan 2, 2014 7:28 AM by Manish kumar

    JBOSS Datasource - Autocommit

    Manish kumar Newbie

      Hi Fellow Members,

       

      I am new to JBOSS. I am facing a problem with Datasource object with Oracle.

      Issue : Auto commit (java.sql.SQLException: You cannot commit with autocommit set).

       

      I used XA Datasource also but of no luck. I don't find any property to set auto commit false.

       

      Kindly let me know if there any way to set it false, other than changing the application source code.

       

      Thanks in advance.

        • 1. Re: JBOSS Datasource - Autocommit
          Wolf-Dieter Fink Master

          What you try to do?

          Could you explain a bit the code in detail and attach the datasource?

          • 2. Re: JBOSS Datasource - Autocommit
            Manish kumar Newbie

            Hi,

            I am trying to create datasource object in standalone.xml.

            I have done using the console and following is the XML configuration.

             

            Location:- ..\Servers\wildfly-8.0.0.CR1\standalone\configuration\standalone.xml

            ------------------------------------------------------------------------------------------------------------------------

            <subsystem xmlns="urn:jboss:domain:datasources:2.0">

                        <datasources>

                            <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">

                                <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>

                                <driver>h2</driver>

                                <security>

                                    <user-name>sa</user-name>

                                    <password>sa</password>

                                </security>

                            </datasource>

                            <datasource jta="false" jndi-name="java:/jdbc/DEFAULT" pool-name="jdbc/DEFAULT" enabled="true" use-java-context="true" use-ccm="false">

                                <connection-url>jdbc:oracle:thin:@IPAddress:1521:DBNAME1</connection-url>

                                <driver-class>oracle.jdbc.OracleDriver</driver-class>

                                <driver>ojdbc6.jar</driver>

                                <security>

                                    <user-name>manish</user-name>

                                    <password>manish</password>

                                </security>

                                <validation>

                                    <validate-on-match>false</validate-on-match>

                                    <background-validation>false</background-validation>

                                </validation>

                                <statement>

                                    <share-prepared-statements>true</share-prepared-statements>

                                </statement>

                            </datasource>

                            <xa-datasource jndi-name="java:/jdbc/LINUXRD" pool-name="LINUXRD" enabled="true" use-ccm="false">

                                <xa-datasource-property name="URL">

                                    jdbc:oracle:thin:@IPAddress:1521:DBNAME2

                                </xa-datasource-property>

                                <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>

                                <driver>ojdbc6.jar</driver>

                                <xa-pool>

                                    <is-same-rm-override>false</is-same-rm-override>

                                    <interleaving>false</interleaving>

                                    <pad-xid>false</pad-xid>

                                    <wrap-xa-resource>false</wrap-xa-resource>

                                </xa-pool>

                                <security>

                                    <user-name>kumar</user-name>

                                    <password>kumar</password>

                                </security>

                                <validation>

                                    <validate-on-match>false</validate-on-match>

                                    <background-validation>false</background-validation>

                                </validation>

                                <statement>

                                    <share-prepared-statements>false</share-prepared-statements>

                                </statement>

                            </xa-datasource>

                            <drivers>

                                <driver name="h2" module="com.h2database.h2">

                                    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>

                                </driver>

                            </drivers>

                        </datasources>

                    </subsystem>

            --------------------------------------------------------------------------------------------------------------

            I have done using the simple Datasource tag and XA-Datasource type. In both the way, I am getting the same error. I don't see any connection property for auto commit.

            I tested the connection and both are working. But when launching my application, I am getting sql exception on autocommit.

             

            Thanks.

            Manish

            • 3. Re: JBOSS Datasource - Autocommit
              Wolf-Dieter Fink Master

              I'm still missing the explanation what you do, with your code.

              When do you see the Exception?

              • 4. Re: JBOSS Datasource - Autocommit
                Manish kumar Newbie

                Hi,

                I wish you a very happy new year 2014.

                I am getting following error after launching my app.

                07:58:25,464 ERROR [stderr] (default task-19) java.sql.SQLException: You cannot commit with autocommit set!

                07:58:25,465 ERROR [stderr] (default task-19)   at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.jd

                bcCommit(BaseWrapperManagedConnection.java:1068)

                07:58:25,466 ERROR [stderr] (default task-19)   at org.jboss.jca.adapters.jdbc.WrappedConnection.commit(Wrappe

                dConnection.java:758)---

                Kindly let me know if you want any further information.

                Regards,

                • 5. Re: JBOSS Datasource - Autocommit
                  Wolf-Dieter Fink Master

                  Could you attach the full stacktrace, otherwise I can not identify whether the error is from your code or JBoss?

                  If you see your code in the stack, could you attach the appropriate classes also?

                  • 6. Re: JBOSS Datasource - Autocommit
                    Manish kumar Newbie

                    13:29:17,204 ERROR [stderr] (default task-6) java.sql.SQLException: You cannot commit with autocommit set!

                    13:29:17,205 ERROR [stderr] (default task-6)    at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.jd

                    bcCommit(BaseWrapperManagedConnection.java:1068)

                    13:29:17,205 ERROR [stderr] (default task-6)    at org.jboss.jca.adapters.jdbc.WrappedConnection.commit(Wrappe

                    dConnection.java:758)

                    13:29:17,205 ERROR [stderr] (default task-6)    at com.aldata.authentication.GOLDAuthenticator.updateLastConne

                    ctionTime(GOLDAuthenticator.java:128)

                    13:29:17,205 ERROR [stderr] (default task-6)    at com.aldata.authentication.GOLDAuthenticator.checkInDatabase

                    (GOLDAuthenticator.java:100)

                    13:29:17,206 ERROR [stderr] (default task-6)    at com.aldata.authentication.GOLDAuthenticator.authenticate(GO

                    LDAuthenticator.java:48)

                    13:29:17,206 ERROR [stderr] (default task-6)    at org.springframework.security.authentication.ProviderManager

                    .authenticate(ProviderManager.java:156)

                    13:29:17,206 ERROR [stderr] (default task-6)    at com.aldata.authentication.GOLDAuthenticationExtractor.doAut

                    hentication(GOLDAuthenticationExtractor.java:192)

                    13:29:17,206 ERROR [stderr] (default task-6)    at com.aldata.authentication.GOLDAuthenticationExtractor.doFil

                    ter(GOLDAuthenticationExtractor.java:149)

                    13:29:17,207 ERROR [stderr] (default task-6)    at org.springframework.security.web.FilterChainProxy$VirtualFi

                    lterChain.doFilter(FilterChainProxy.java:323)

                    13:29:17,207 ERROR [stderr] (default task-6)    at org.springframework.security.web.context.SecurityContextPer

                    sistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

                    13:29:17,208 ERROR [stderr] (default task-6)    at org.springframework.security.web.FilterChainProxy$VirtualFi

                    lterChain.doFilter(FilterChainProxy.java:323)

                    13:29:17,208 ERROR [stderr] (default task-6)    at org.springframework.security.web.FilterChainProxy.doFilter(

                    FilterChainProxy.java:173)

                    13:29:17,208 ERROR [stderr] (default task-6)    at org.springframework.web.filter.DelegatingFilterProxy.invoke

                    Delegate(DelegatingFilterProxy.java:237)

                    13:29:17,209 ERROR [stderr] (default task-6)    at org.springframework.web.filter.DelegatingFilterProxy.doFilt

                    er(DelegatingFilterProxy.java:167)

                    13:29:17,209 ERROR [stderr] (default task-6)    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilt

                    er.java:56)

                    13:29:17,209 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.

                    doFilter(FilterHandler.java:132)

                    13:29:17,210 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.FilterHandler.handleRequest(Fi

                    lterHandler.java:85)

                    13:29:17,210 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.security.ServletSecurityRoleHa

                    ndler.handleRequest(ServletSecurityRoleHandler.java:61)

                    13:29:17,210 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletDispatchingHandler.hand

                    leRequest(ServletDispatchingHandler.java:36)

                    13:29:17,211 ERROR [stderr] (default task-6)    at org.wildfly.extension.undertow.security.SecurityContextAsso

                    ciationHandler.handleRequest(SecurityContextAssociationHandler.java:70)

                    13:29:17,211 ERROR [stderr] (default task-6)    at io.undertow.server.handlers.PredicateHandler.handleRequest(

                    PredicateHandler.java:25)

                    13:29:17,211 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.security.SSLInformationAssocia

                    tionHandler.handleRequest(SSLInformationAssociationHandler.java:113)

                    13:29:17,212 ERROR [stderr] (default task-6)    at io.undertow.security.handlers.AuthenticationCallHandler.han

                    dleRequest(AuthenticationCallHandler.java:52)

                    13:29:17,212 ERROR [stderr] (default task-6)    at io.undertow.security.handlers.AbstractConfidentialityHandle

                    r.handleRequest(AbstractConfidentialityHandler.java:45)

                    13:29:17,212 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.security.ServletConfidentialit

                    yConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61)

                    13:29:17,213 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.security.CachedAuthenticatedSe

                    ssionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:67)

                    13:29:17,213 ERROR [stderr] (default task-6)    at io.undertow.security.handlers.SecurityInitialHandler.handle

                    Request(SecurityInitialHandler.java:70)

                    13:29:17,213 ERROR [stderr] (default task-6)    at io.undertow.server.handlers.PredicateHandler.handleRequest(

                    PredicateHandler.java:25)

                    13:29:17,214 ERROR [stderr] (default task-6)    at org.wildfly.extension.undertow.security.jacc.JACCContextIdH

                    andler.handleRequest(JACCContextIdHandler.java:61)

                    13:29:17,214 ERROR [stderr] (default task-6)    at io.undertow.server.handlers.PredicateHandler.handleRequest(

                    PredicateHandler.java:25)

                    13:29:17,214 ERROR [stderr] (default task-6)    at io.undertow.server.handlers.PredicateHandler.handleRequest(

                    PredicateHandler.java:25)

                    13:29:17,215 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletInitialHandler.handleFi

                    rstRequest(ServletInitialHandler.java:240)

                    13:29:17,215 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletInitialHandler.dispatch

                    Request(ServletInitialHandler.java:227)

                    13:29:17,215 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletInitialHandler.access$0

                    00(ServletInitialHandler.java:73)

                    13:29:17,215 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletInitialHandler$1.handle

                    Request(ServletInitialHandler.java:146)

                    13:29:17,216 ERROR [stderr] (default task-6)    at io.undertow.server.Connectors.executeRootHandler(Connectors

                    .java:164)

                    13:29:17,216 ERROR [stderr] (default task-6)    at io.undertow.server.HttpServerExchange$1.run(HttpServerExcha

                    nge.java:654)

                    13:29:17,216 ERROR [stderr] (default task-6)    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoo

                    lExecutor.java:1145)

                    13:29:17,216 ERROR [stderr] (default task-6)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPo

                    olExecutor.java:615)

                    13:29:17,217 ERROR [stderr] (default task-6)    at java.lang.Thread.run(Thread.java:722)

                    13:29:17,218 ERROR [stderr] (default task-6) org.springframework.security.authentication.AuthenticationService

                    Exception: java.sql.SQLException: You cannot commit with autocommit set!

                    13:29:17,218 ERROR [stderr] (default task-6)    at com.aldata.authentication.GOLDAuthenticator.authenticate(GO

                    LDAuthenticator.java:59)

                    13:29:17,218 ERROR [stderr] (default task-6)    at org.springframework.security.authentication.ProviderManager

                    .authenticate(ProviderManager.java:156)

                    13:29:17,218 ERROR [stderr] (default task-6)    at com.aldata.authentication.GOLDAuthenticationExtractor.doAut

                    hentication(GOLDAuthenticationExtractor.java:192)

                    13:29:17,219 ERROR [stderr] (default task-6)    at com.aldata.authentication.GOLDAuthenticationExtractor.doFil

                    ter(GOLDAuthenticationExtractor.java:149)

                    13:29:17,219 ERROR [stderr] (default task-6)    at org.springframework.security.web.FilterChainProxy$VirtualFi

                    lterChain.doFilter(FilterChainProxy.java:323)

                    13:29:17,219 ERROR [stderr] (default task-6)    at org.springframework.security.web.context.SecurityContextPer

                    sistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

                    13:29:17,219 ERROR [stderr] (default task-6)    at org.springframework.security.web.FilterChainProxy$VirtualFi

                    lterChain.doFilter(FilterChainProxy.java:323)

                    13:29:17,220 ERROR [stderr] (default task-6)    at org.springframework.security.web.FilterChainProxy.doFilter(

                    FilterChainProxy.java:173)

                    13:29:17,220 ERROR [stderr] (default task-6)    at org.springframework.web.filter.DelegatingFilterProxy.invoke

                    Delegate(DelegatingFilterProxy.java:237)

                    13:29:17,220 ERROR [stderr] (default task-6)    at org.springframework.web.filter.DelegatingFilterProxy.doFilt

                    er(DelegatingFilterProxy.java:167)

                    13:29:17,221 ERROR [stderr] (default task-6)    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilt

                    er.java:56)

                    13:29:17,221 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.

                    doFilter(FilterHandler.java:132)

                    13:29:17,221 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.FilterHandler.handleRequest(Fi

                    lterHandler.java:85)

                    13:29:17,221 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.security.ServletSecurityRoleHa

                    ndler.handleRequest(ServletSecurityRoleHandler.java:61)

                    13:29:17,222 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletDispatchingHandler.hand

                    leRequest(ServletDispatchingHandler.java:36)

                    13:29:17,222 ERROR [stderr] (default task-6)    at org.wildfly.extension.undertow.security.SecurityContextAsso

                    ciationHandler.handleRequest(SecurityContextAssociationHandler.java:70)

                    13:29:17,222 ERROR [stderr] (default task-6)    at io.undertow.server.handlers.PredicateHandler.handleRequest(

                    PredicateHandler.java:25)

                    13:29:17,222 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.security.SSLInformationAssocia

                    tionHandler.handleRequest(SSLInformationAssociationHandler.java:113)

                    13:29:17,223 ERROR [stderr] (default task-6)    at io.undertow.security.handlers.AuthenticationCallHandler.han

                    dleRequest(AuthenticationCallHandler.java:52)

                    13:29:17,223 ERROR [stderr] (default task-6)    at io.undertow.security.handlers.AbstractConfidentialityHandle

                    r.handleRequest(AbstractConfidentialityHandler.java:45)

                    13:29:17,223 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.security.ServletConfidentialit

                    yConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61)

                    13:29:17,224 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.security.CachedAuthenticatedSe

                    ssionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:67)

                    13:29:17,224 ERROR [stderr] (default task-6)    at io.undertow.security.handlers.SecurityInitialHandler.handle

                    Request(SecurityInitialHandler.java:70)

                    13:29:17,224 ERROR [stderr] (default task-6)    at io.undertow.server.handlers.PredicateHandler.handleRequest(

                    PredicateHandler.java:25)

                    13:29:17,224 ERROR [stderr] (default task-6)    at org.wildfly.extension.undertow.security.jacc.JACCContextIdH

                    andler.handleRequest(JACCContextIdHandler.java:61)

                    13:29:17,225 ERROR [stderr] (default task-6)    at io.undertow.server.handlers.PredicateHandler.handleRequest(

                    PredicateHandler.java:25)

                    13:29:17,225 ERROR [stderr] (default task-6)    at io.undertow.server.handlers.PredicateHandler.handleRequest(

                    PredicateHandler.java:25)

                    13:29:17,225 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletInitialHandler.handleFi

                    rstRequest(ServletInitialHandler.java:240)

                    13:29:17,225 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletInitialHandler.dispatch

                    Request(ServletInitialHandler.java:227)

                    13:29:17,226 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletInitialHandler.access$0

                    00(ServletInitialHandler.java:73)

                    13:29:17,226 ERROR [stderr] (default task-6)    at io.undertow.servlet.handlers.ServletInitialHandler$1.handle

                    Request(ServletInitialHandler.java:146)

                    13:29:17,226 ERROR [stderr] (default task-6)    at io.undertow.server.Connectors.executeRootHandler(Connectors

                    .java:164)

                    13:29:17,227 ERROR [stderr] (default task-6)    at io.undertow.server.HttpServerExchange$1.run(HttpServerExcha

                    nge.java:654)

                    13:29:17,227 ERROR [stderr] (default task-6)    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoo

                    lExecutor.java:1145)

                    13:29:17,227 ERROR [stderr] (default task-6)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPo

                    olExecutor.java:615)

                    13:29:17,228 ERROR [stderr] (default task-6)    at java.lang.Thread.run(Thread.java:722)