Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Eclipselink complains about closed statement in entityManager.persist()

I can't see how this could occur, EclipseLink is well tested with many
DataSources.

Do you have statement caching enabled in EclipseLink?  If so you should
disable this, as you must enable statement caching in the datasource.

Also, are you by chance using an Oracle proxy connection?  There is a
statement caching issue with Oracle proxy connections, so you should disable
statement caching in your datasource if using this.

Otherwise, try disabling statement caching in your datasource, it seems to
be having issues.



Agelatos Athanasios wrote:
> 
> Hi
> 
> Running Spring 2.5.6 + JUnit 4.3 and Eclipselink 1.0.1 as JPA provider,
> I get the following exception as shown below.
> 
> I've tried both c3p0 and apache.commons.dbcp for connection pools, but
> the result is the same- it seems that Eclipselink is closing a statement
> and then tries to reuse it?
> 
> Thank you for any help
> 
> Local Exception Stack: 
> 
> Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.0.2
> (Build 20081024)): org.eclipse.persistence.exceptions.DatabaseException
> 
> Internal Exception: java.sql.SQLException:
> org.apache.commons.dbcp.DelegatingPreparedStatement with address:
> "oracle.jdbc.driver.OraclePreparedStatementWrapper@30e71" is closed.
> 
> Error Code: 0
> 
> Call: SELECT SID, DAT_TRAD_REQ_REL, DIV_PROH, SEALS_AFF_BY_USER_ID,
> TRANS_OPER_STAT_TYP_ID, DAT_STAT_UPD, BIND_ITIN, DAT_GOODS_REL,
> NUMB_OF_SEALS, ARR_NOT_PLAC_LNG, ARR_SIMPL_PROC, DEP_TRAD_ADDR, NOT_COD,
> ENQ_AT_DEST, DISP_COUNTRY_ID, SEALS_OK, DAT_ACC, DEC_VIA, DEP_RISK_ANA,
> LOCKED, DAT_DISCR_SOLV, DAT_ARR_NOT, ARR_AGR_GOODS_LOC_LNG, MESS_PHASE,
> DEST_CUST_OFF_ID, DEST_DIAL_LANG_ID, OR_DEST_CUST_OFF_ID,
> ARR_AGR_GOODS_LOC, DAT_WRITT_OFF, ENQ_ALLRSP_RCD, ARR_CUST_OFF_ID,
> DECL_TYP_ID, UNL_COMPL, DEP_CUST_OFF_ID, DEP_CONTR_RES_TYP_ID,
> OODEP_RES_DISCR, DAT_TIM_LIM_FOR_ARR, AUD_USER_ID, DAT_STAT_UPD_NA_TRAN,
> DAT_TIM_ALL_TRANS, CONTR_NAM, CONTR_BY_LNG, RISK_ANA, PROC, INC,
> ENQ_RCV, LRN, CONTR_RES_SEC_COD, DAT_TIM_DEP_CONTR, TRAD_SP_AUTH_ID,
> AAR_SENT, TRA_RISK_ANA, ENQ_EXP_TIMER, CONTR_REM_LNG, DAT_TIM_ARR_CONTR,
> DAT_ARR, NUMB_OF_LOAD_LISTS, UNL_VERS_NUMB, Q_CUST_OFF_ID, LOCKED_DISP,
> MRN, STAT, SENS, DAT_DISCR_NOT, ARR_VIA, CONTR_REM, BIND_ITIN_LNG,
> ARR_AGR_GOODS_LOC_COD, RISK_TIMER_STATUS, ARR_NOT_PLAC, GUA_ACCEPTED,
> DEST_COUNTRY_ID, OTS_DIV_REC_BY_CUST_OFF_ID, WAIT_FOR_INC_DOC,
> DAT_DOC_RET, DAT_PRINC_NOT_RESP, ARR_CONTR_RES_TYP_ID, BIND_ITIN_FLAG,
> AUD_DAT_TIM, NOT_TXT, DAT_OTS_DIV_ARR_ADV, ARR_RISK_ANA,
> TRANS_OPER_STAT_TYP_ID_NA_TRAN, WAIT_FOR_RES_FLAG,
> DAT_TIM_DES_CONTR_REC, IS_NATIONAL, RELEASE_REQ,
> PRES_AT_DEST_BY_TRADS_SID, ARR_CUST_OFF_ADDR_SID FROM TRANS_OPER WHERE
> (LRN = ?)
> 
>                 bind => [YIANNIS_TEST_HRR]
> 
> Query: ReadAllQuery(com.intrasoft.data.jpa.TransOper)
> 
>                 at
> org.eclipse.persistence.exceptions.DatabaseException.sqlException(Databa
> seException.java:322)
> 
>                 at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicEx
> ecuteCall(DatabaseAccessor.java:646)
> 
>                 at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.execute
> Call(DatabaseAccessor.java:500)
> 
>                 at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeCall(Ab
> stractSession.java:855)
> 
>                 at
> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.ex
> ecuteCall(DatasourceCallQueryMechanism.java:204)
> 
>                 at
> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.ex
> ecuteCall(DatasourceCallQueryMechanism.java:190)
> 
>                 at
> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.ex
> ecuteSelectCall(DatasourceCallQueryMechanism.java:261)
> 
>                 at
> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.se
> lectAllRows(DatasourceCallQueryMechanism.java:594)
> 
>                 at
> org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.select
> AllRowsFromTable(ExpressionQueryMechanism.java:2506)
> 
>                 at
> org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.select
> AllRows(ExpressionQueryMechanism.java:2464)
> 
>                 at
> org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery
> (ReadAllQuery.java:478)
> 
>                 at
> org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuer
> y(ObjectLevelReadQuery.java:879)
> 
>                 at
> org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java
> :666)
> 
>                 at
> org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevel
> ReadQuery.java:840)
> 
>                 at
> org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:4
> 56)
> 
>                 at
> org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork
> (ObjectLevelReadQuery.java:902)
> 
>                 at
> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecute
> Query(UnitOfWorkImpl.java:2587)
> 
>                 at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(A
> bstractSession.java:1178)
> 
>                 at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(A
> bstractSession.java:1162)
> 
>                 at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(A
> bstractSession.java:1136)
> 
>                 at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(A
> bstractSession.java:1118)
> 
>                 at
> org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQu
> eryImpl.java:399)
> 
>                 at
> org.eclipse.persistence.internal.jpa.EJBQueryImpl.getSingleResult(EJBQue
> ryImpl.java:547)
> 
>                 at
> com.intrasoft.enterprise.services.spring.impl.DBUtils.retrieveTransOper(
> DBUtils.java:136)
> 
>                 at
> com.intrasoft.enterprise.services.spring.impl.DeclarationManagerImpl.sav
> eDeclarationData(DeclarationManagerImpl.java:217)
> 
>                 at
> com.intrasoft.enterprise.services.spring.impl.DeclarationManagerImpl$$Fa
> stClassByCGLIB$$e2cbb956.invoke(<generated>)
> 
>                 at
> net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
> 
>                 at
> org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.i
> nvokeJoinpoint(Cglib2AopProxy.java:700)
> 
>                 at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
> lectiveMethodInvocation.java:149)
> 
>                 at
> org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proc
> eed(MethodInvocationProceedingJoinPoint.java:77)
> 
>                 at
> com.intrasoft.enterprise.services.spring.impl.utils.LoggingAspect.log(Lo
> ggingAspect.java:74)
> 
>                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> 
>                 at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
> 
>                 at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
> 
>                 at java.lang.reflect.Method.invoke(Method.java:585)
> 
>                 at
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod
> WithGivenArgs(AbstractAspectJAdvice.java:627)
> 
>                 at
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod
> (AbstractAspectJAdvice.java:616)
> 
>                 at
> org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAround
> Advice.java:64)
> 
>                 at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
> lectiveMethodInvocation.java:171)
> 
>                 at
> org.springframework.transaction.interceptor.TransactionInterceptor.invok
> e(TransactionInterceptor.java:106)
> 
>                 at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
> lectiveMethodInvocation.java:171)
> 
>                 at
> org.springframework.transaction.interceptor.TransactionInterceptor.invok
> e(TransactionInterceptor.java:106)
> 
>                 at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
> lectiveMethodInvocation.java:171)
> 
>                 at
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(E
> xposeInvocationInterceptor.java:89)
> 
>                 at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
> lectiveMethodInvocation.java:171)
> 
>                 at
> org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedIntercept
> or.intercept(Cglib2AopProxy.java:635)
> 
>                 at
> com.intrasoft.enterprise.services.spring.impl.DeclarationManagerImpl$$En
> hancerByCGLIB$$7e5fddbd.saveDeclarationData(<generated>)
> 
>                 at
> com.intrasoft.enterprise.messaging.spring.impl.HandleReleaseRequestImpl.
> handleReleaseRequest(HandleReleaseRequestImpl.java:190)
> 
>                 at
> com.intrasoft.enterprise.messaging.spring.impl.HandleReleaseRequestImpl$
> $FastClassByCGLIB$$28aeb121.invoke(<generated>)
> 
>                 at
> net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
> 
>                 at
> org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.i
> nvokeJoinpoint(Cglib2AopProxy.java:700)
> 
>                 at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
> lectiveMethodInvocation.java:149)
> 
>                 at
> org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proc
> eed(MethodInvocationProceedingJoinPoint.java:77)
> 
>                 at
> com.intrasoft.enterprise.services.spring.impl.utils.LoggingAspect.log(Lo
> ggingAspect.java:74)
> 
>                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> 
>                 at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
> 
>                 at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
> 
>                 at java.lang.reflect.Method.invoke(Method.java:585)
> 
>                 at
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod
> WithGivenArgs(AbstractAspectJAdvice.java:627)
> 
>                 at
> org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod
> (AbstractAspectJAdvice.java:616)
> 
>                 at
> org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAround
> Advice.java:64)
> 
>                 at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
> lectiveMethodInvocation.java:171)
> 
>                 at
> org.springframework.transaction.interceptor.TransactionInterceptor.invok
> e(TransactionInterceptor.java:106)
> 
>                 at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
> lectiveMethodInvocation.java:171)
> 
>                 at
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(E
> xposeInvocationInterceptor.java:89)
> 
>                 at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
> lectiveMethodInvocation.java:171)
> 
>                 at
> org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedIntercept
> or.intercept(Cglib2AopProxy.java:635)
> 
>                 at
> com.intrasoft.enterprise.messaging.spring.impl.HandleReleaseRequestImpl$
> $EnhancerByCGLIB$$8a719346.handleReleaseRequest(<generated>)
> 
>                 at
> com.intrasoft.enterprise.tests.HandleReleaseRequestTest.testHandleReleas
> eRequestAlt2(HandleReleaseRequestTest.java:169)
> 
>                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> 
>                 at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
> 
>                 at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
> 
>                 at java.lang.reflect.Method.invoke(Method.java:585)
> 
>                 at
> org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTe
> stMethod.java:160)
> 
>                 at
> org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod
> (SpringMethodRoadie.java:233)
> 
>                 at
> org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThe
> nTestThenAfters.run(SpringMethodRoadie.java:333)
> 
>                 at
> org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepeti
> tions(SpringMethodRoadie.java:217)
> 
>                 at
> org.springframework.test.context.junit4.SpringMethodRoadie.runTest(Sprin
> gMethodRoadie.java:197)
> 
>                 at
> org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMet
> hodRoadie.java:143)
> 
>                 at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTe
> stMethod(SpringJUnit4ClassRunner.java:160)
> 
>                 at
> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunne
> r.java:51)
> 
>                 at
> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.jav
> a:44)
> 
>                 at
> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:2
> 7)
> 
>                 at
> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
> 
>                 at
> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:
> 42)
> 
>                 at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(Spri
> ngJUnit4ClassRunner.java:97)
> 
>                 at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4Tes
> tReference.java:45)
> 
>                 at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.ja
> va:38)
> 
>                 at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
> stRunner.java:460)
> 
>                 at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
> stRunner.java:673)
> 
>                 at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
> ner.java:386)
> 
>                 at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
> nner.java:196)
> 
> Caused by: java.sql.SQLException:
> org.apache.commons.dbcp.DelegatingPreparedStatement with address:
> "oracle.jdbc.driver.OraclePreparedStatementWrapper@30e71" is closed.
> 
>                 at
> org.apache.commons.dbcp.DelegatingStatement.checkOpen(DelegatingStatemen
> t.java:137)
> 
>                 at
> org.apache.commons.dbcp.DelegatingPreparedStatement.setString(Delegating
> PreparedStatement.java:132)
> 
>                 at
> org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.setPara
> meterValueInDatabaseCall(DatabasePlatform.java:1734)
> 
>                 at
> org.eclipse.persistence.internal.databaseaccess.DatabaseCall.prepareStat
> ement(DatabaseCall.java:667)
> 
>                 at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicEx
> ecuteCall(DatabaseAccessor.java:550)
> 
>                 ... 90 more
> 
> Internet communications are not secure; 
> therefore, the integrity of this e-mail cannot be guaranteed following
> transmission on the Internet.
> This e-mail may contain confidential information. If you have received
> this e-mail in error, please notify the sender and erase this e-mail. Use
> of this e-mail by any person other than the addressee is strictly
> forbidden. This e-mail is believed to be free of any virus that might
> adversely affect the addressee's computer system; however, no
> responsibility is accepted for any loss or damage arising in any way from
> its use. All the preceding disclaimers also apply to any possible
> attachments to this e-mail.
> 
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Eclipselink-complains-about-closed-statement-in-entityManager.persist%28%29-tp23424157p23428519.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top