[ 
https://issues.apache.org/jira/browse/OPENEJB-996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jean-Louis MONTEIRO closed OPENEJB-996.
---------------------------------------

    Resolution: Invalid

OK, we can close I guess.
Gave it another try with Hibernate and it works.
With OpenJPA 2.x (and >) it also works.

> JDBC connection are not released correctly with intra VM Open EJB
> -----------------------------------------------------------------
>
>                 Key: OPENEJB-996
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-996
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1
>         Environment: maven 2.0.9, EJB3, Windows 2000, Eclipse 3.4.1, Maven 
> Integration For Eclipse 0.9.6
>            Reporter: Vincent MATHON
>            Assignee: Jean-Louis MONTEIRO
>         Attachments: OpenEJBBUG.zip
>
>
> I have built a Junit test case from The movies OpenEJB example.
> I have two SLSB with Required Tx. I have configured a pool with only 1 
> instance to obtain predictive behaviour.
> The first SLSB save an entity (a movie) without throwing exception whereas 
> the second always throw a triggered exception after persisting the movie 
> (this is an ApplicationException with rollback=true but I can reproduce the 
> bug with a RuntimeException too).
> I can run five times (and more) the first SLSB without any problem. When I 
> run twice the second SLSB I obtain the following exception:
> #########################################################################################
> ############################# WITHOUT EXCEPTION 
> #########################################
> #########################################################################################
> ############################# FIRST RUN ... 
> #############################################
> ############################# SECOND RUN ... 
> #############################################
> ############################# THIRD RUN ... 
> #############################################
> ############################# FOURTH RUN ... 
> #############################################
> ############################# FIFTH RUN ... 
> #############################################
> #########################################################################################
> ############################# WITH EXCEPTION 
> ############################################
> #########################################################################################
> ############################# FIRST RUN ... 
> #############################################
> ############################# SECOND RUN (Should Block) ... 
> #############################
> WARN - Unexpected exception from beforeCompletion; transaction will roll back
> <openjpa-1.1.0-r422266:659716 nonfatal general error> 
> org.apache.openjpa.persistence.PersistenceException: Unable to acquire a new 
> connection from the pool
>       at 
> org.apache.openjpa.jdbc.sql.SQLExceptions.narrow(SQLExceptions.java:146)
>       at 
> org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4150)
>       at 
> org.apache.openjpa.jdbc.sql.HSQLDictionary.newStoreException(HSQLDictionary.java:292)
>       at 
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
>       at 
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:88)
>       at 
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:64)
>       at 
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.connect(JDBCStoreManager.java:762)
>       at 
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.retainConnection(JDBCStoreManager.java:201)
>       at 
> org.apache.openjpa.kernel.DelegatingStoreManager.retainConnection(DelegatingStoreManager.java:163)
>       at 
> org.apache.openjpa.kernel.BrokerImpl.retainConnection(BrokerImpl.java:3700)
>       at 
> org.apache.openjpa.kernel.BrokerImpl.beginStoreManagerTransaction(BrokerImpl.java:1280)
>       at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1965)
>       at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1905)
>       at 
> org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1823)
>       at 
> org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:515)
>       at 
> org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:500)
>       at 
> org.apache.geronimo.transaction.manager.TransactionImpl.rollback(TransactionImpl.java:473)
>       at 
> org.apache.geronimo.transaction.manager.TransactionManagerImpl.rollback(TransactionManagerImpl.java:258)
>       at 
> org.apache.openejb.core.transaction.JtaTransactionPolicy.rollbackTransaction(JtaTransactionPolicy.java:333)
>       at 
> org.apache.openejb.core.transaction.JtaTransactionPolicy.completeTransaction(JtaTransactionPolicy.java:283)
>       at 
> org.apache.openejb.core.transaction.TxRequired.commit(TxRequired.java:71)
>       at 
> org.apache.openejb.core.transaction.EjbTransactionUtil.afterInvoke(EjbTransactionUtil.java:74)
>       at 
> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:231)
>       at 
> org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:169)
>       at 
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:217)
>       at 
> org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:77)
>       at 
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:286)
>       at $Proxy23.addMovie(Unknown Source)
>       at 
> org.superbiz.injection.tx.MoviesTest.testConnectionUnreleasedCorrectlyWhenExceptionIsThrown(MoviesTest.java:114)
>       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:585)
>       at junit.framework.TestCase.runTest(TestCase.java:168)
>       at junit.framework.TestCase.runBare(TestCase.java:134)
>       at junit.framework.TestResult$1.protect(TestResult.java:110)
>       at junit.framework.TestResult.runProtected(TestResult.java:128)
>       at junit.framework.TestResult.run(TestResult.java:113)
>       at junit.framework.TestCase.run(TestCase.java:124)
>       at junit.framework.TestSuite.runTest(TestSuite.java:232)
>       at junit.framework.TestSuite.run(TestSuite.java:227)
>       at 
> org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
>       at 
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>       at 
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>       at 
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:165)
>       at org.apache.maven.surefire.Surefire.run(Surefire.java:107)
>       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:585)
>       at 
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:289)
>       at 
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:993)
> Caused by: java.sql.SQLException: Unable to acquire a new connection from the 
> pool
>       at 
> org.apache.commons.dbcp.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:120)
>       at 
> org.apache.commons.dbcp.managed.ManagedConnection.<init>(ManagedConnection.java:55)
>       at 
> org.apache.commons.dbcp.managed.ManagedDataSource.getConnection(ManagedDataSource.java:77)
>       at 
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:884)
>       at 
> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:106)
>       at 
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:87)
>       at 
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.connectInternal(JDBCStoreManager.java:773)
>       at 
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.connect(JDBCStoreManager.java:758)
>       ... 45 more
> Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
>       at 
> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:825)
>       at 
> org.apache.commons.dbcp.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:117)
>       ... 52 more
> So, the JDBC connection is not released correctly. It might be related to 
> OPENEJB-953.
> Vincent

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to