users@glassfish.java.net

Glassfish 3.1, Mysql datasource, autocommit

From: <forums_at_java.net>
Date: Tue, 2 Aug 2011 14:42:57 -0500 (CDT)

Hello,

i want to create a mysql datasource and use it via jndi lookup as a
datasource,

e.g. in a project which is configurd via spring configuration. The problem is
that

the project (activiti.org) creates its database schema on first
instantiation, but

i get the following exceptions because of enabled autocommit:

[#|2011-08-02T20:43:39.328+0200|SEVERE|glassfish3.1|javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource|_ThreadID=65;_ThreadName=Thread-1;|RAR5031:System
Exception
javax.resource.spi.LocalTransactionException: Can't call commit when
autocommit=true
    at com.sun.gjc.spi.LocalTransaction.commit(LocalTransaction.java:112)
    at
com.sun.enterprise.resource.ConnectorXAResource.commit(ConnectorXAResource.java:124)
    at
com.sun.enterprise.transaction.JavaEETransactionImpl.commit(JavaEETransactionImpl.java:503)
    at
com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:867)
    at
com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5115)
    at
com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4894)
    at
com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:555)
    at
com.sun.ejb.containers.AbstractSingletonContainer.access$100(AbstractSingletonContainer.java:79)
    at
com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:717)
    at
com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:449)
    at
org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:216)
    at
org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:177)
    at
org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:155)
    at
org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:177)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
    at
org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:286)
    at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
    at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at
org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247)
    at
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
    at
com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:465)
    at
com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:222)
    at
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
    at
com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
    at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
    at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
    at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
    at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
    at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.sql.SQLException: Can't call commit when autocommit=true
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:930)
    at com.mysql.jdbc.ConnectionImpl.commit(ConnectionImpl.java:1602)
    at com.sun.gjc.spi.LocalTransaction.commit(LocalTransaction.java:106)
    ... 44 more

 

how can i disable autocommit on the JDBC resource or the JDBC connection
pool?

i use com.mysql.jdbc.jdbc2.optional.MysqlDataSource and
mysql-connector-java-5.1.10.jar

 


--
[Message sent by forum member 'chris.joelly']
View Post: http://forums.java.net/node/828929