openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Albert Lee <allee8...@gmail.com>
Subject Re: MySQLNonTransientConnectionException: Can't call rollback when autocommit=true
Date Thu, 13 Mar 2014 14:23:26 GMT
Wondering what is the cause of the rollback from the SchemaTool, i.e.

org.apache.openjpa.lib.jdbc.
ConfiguringConnectionDecorator$ConfiguringConnection.rollback(ConfiguringConnectionDecorator.java:132)
        at
org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1219)

and what data source type was used?



On Thu, Mar 13, 2014 at 7:59 AM, Haim Schneider <HAIMS@il.ibm.com> wrote:

> Automatic table generation fails with MySQL. I get the exception:
>
> MySQLNonTransientConnectionException: Can't call rollback when
> autocommit=true
>
> This exception causes the connection to be closed, and the automatic table
> generation fails.
>
> The exception is thrown by the SchemaTool.executeSQL method. I checked the
> source code and found that the method calls rollback prior to executing
> the SQL statement. The problem is that the method also set autocommit to
> true before calling rollback, and this leads to the
> MySQLNonTransientConnectionException that causes the connection to be
> closed.
>
> Is there any workaround?
>
> The complete exception is:
>
> com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
> Can't call rollback when autocommit=true
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>         at
>
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>         at
>
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
>         at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
>         at com.mysql.jdbc.Util.getInstance(Util.java:386)
>         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
>         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
>         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
>         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
>         at
> com.mysql.jdbc.ConnectionImpl.rollback(ConnectionImpl.java:5065)
>         at
>
> com.mysql.jdbc.jdbc2.optional.ConnectionWrapper.rollback(ConnectionWrapper.java:794)
>         at
>
> com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.rollback(WSJdbcConnection.java:2593)
>         at
>
> org.apache.openjpa.lib.jdbc.DelegatingConnection.rollback(DelegatingConnection.java:179)
>         at
>
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection.rollback(LoggingConnectionDecorator.java:356)
>         at
>
> org.apache.openjpa.lib.jdbc.DelegatingConnection.rollback(DelegatingConnection.java:179)
>         at
>
> org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.rollback(ConfiguringConnectionDecorator.java:132)
>         at
> org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1219)
>         at
> org.apache.openjpa.jdbc.schema.SchemaTool.createTable(SchemaTool.java:975)
>         at
> org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:551)
>         at
> org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:366)
>         at
> org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:343)
>         at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:505)
>         at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:455)
>         at
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:160)
>         at
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:164)
>         at
>
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:122)
>         at
>
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:209)
>         at
>
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
>         at
>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
>         at
>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
>         at
>
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
>         at
>
> org.springframework.orm.jpa.JpaTransactionManager.createEntityManagerForTransaction(JpaTransactionManager.java:445)
>         at
>
> org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:366)
>         at
>
> org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
>         at
>
> org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:336)
>         at
>
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105)
>         at
>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>         at
>
> org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
>         at
>
> com.ibm.mbaas.mam.dao.MAMClientDAO$$EnhancerByCGLIB$$e32fb58f.getAllMetadata(<generated>)
>         at
>
> com.ibm.mbaas.mam.controllers.ClientMetadataController.getClients(ClientMetadataController.java:173)
>         at
>
> com.ibm.mbaas.mam.controllers.ClientMetadataController.getAllClientsMetadata(ClientMetadataController.java:105)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at
>
> org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
>         at
>
> org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
>         at
>
> org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
>         at
>
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
>         at
>
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
>         at
>
> org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
>         at
>
> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
>         at
>
> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
>         at
>
> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
>         at
>
> org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
>         at
>
> com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1240)
>         at
>
> com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:760)
>         at
>
> com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
>         at
>
> com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:127)
>         at
>
> com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:88)
>         at
>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>         at
>
> org.cloudfoundry.identity.uaa.security.web.SecurityFilterChainPostProcessor$UaaLoggingFilter.doFilter(SecurityFilterChainPostProcessor.java:195)
>         at
>
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
>         at
>
> org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
>         at
>
> org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
>         at
>
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
>         at
>
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
>         at
>
> com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
>         at
>
> com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:85)
>         at
>
> com.ibm.ws.icap.security.uaa.filter.OverrideServerPortFilter.doFilter(OverrideServerPortFilter.java:48)
>         at
>
> com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
>         at
>
> com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:85)
>         at
>
> com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:949)
>         at
>
> com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1029)
>         at
> com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4499)
>         at
>
> com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:282)
>         at
> com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:954)
>         at
>
> com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:252)
>         at
>
> com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:584)
>         at
> com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:439)
>         at com.ibm.ws.threading.internal.Worker.run(Worker.java:421)
>         at java.lang.Thread.run(Thread.java:724)
>
> Thanks,
> Haim Schneider




-- 
Albert Lee.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message