Results 1 to 9 of 9

Thread: connection proxy not usable after transaction completion

  1. #1

    Default connection proxy not usable after transaction completion

    We have an issue with our job running on Spring Batch Admin 1.0.0.M3 with Spring Batch 2.1.0 and Spring 3.0.2

    During one step we get the following

    Code:
    [INFO] [talledLocalContainer] 2010-05-12 09:55:40 [SimpleAsyncTaskExecutor-2] SimpleRetryExceptionHandler [DEBUG] Handled non-fatal exception
    [INFO] [talledLocalContainer] org.hibernate.HibernateException: connnection proxy not usable after transaction completion
    [INFO] [talledLocalContainer]   at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:66)
    [INFO] [talledLocalContainer]   at $Proxy86.prepareStatement(Unknown Source)
    [INFO] [talledLocalContainer]   at org.springframework.jdbc.core.JdbcTemplate$SimplePreparedStatementCreator.createPreparedStatement(JdbcTemplate.java:1362)
    [INFO] [talledLocalContainer]   at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:580)
    [INFO] [talledLocalContainer]   at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:811)
    [INFO] [talledLocalContainer]   at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:867)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.persistSerializedContext(JdbcExecutionContextDao.java:193)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.updateExecutionContext(JdbcExecutionContextDao.java:136)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.repository.support.SimpleJobRepository.updateExecutionContext(SimpleJobRepository.java:178)
    [INFO] [talledLocalContainer]   at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source)
    [INFO] [talledLocalContainer]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [INFO] [talledLocalContainer]   at java.lang.reflect.Method.invoke(Method.java:585)
    [INFO] [talledLocalContainer]   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    [INFO] [talledLocalContainer]   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    [INFO] [talledLocalContainer]   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    [INFO] [talledLocalContainer]   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    [INFO] [talledLocalContainer]   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    [INFO] [talledLocalContainer]   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    [INFO] [talledLocalContainer]   at $Proxy25.updateExecutionContext(Unknown Source)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:391)
    [INFO] [talledLocalContainer]   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:261)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76)
    [INFO] [talledLocalContainer]   at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367)
    [INFO] [talledLocalContainer]   at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:214)
    [INFO] [talledLocalContainer]   at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:247)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:196)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:115)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:99)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:281)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120)
    [INFO] [talledLocalContainer]   at java.lang.Thread.run(Thread.java:595)
    Which leads to

    Code:
    [INFO] [talledLocalContainer] 2010-05-12 09:55:40 [SimpleAsyncTaskExecutor-2] AbstractStep [ERROR] Encountered an error executing the step
    [INFO] [talledLocalContainer] org.springframework.batch.core.JobInterruptedException: Job interrupted status detected.
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.step.ThreadStepInterruptionPolicy.checkInterrupted(ThreadStepInterruptionPolicy.java:44)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:257)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76)
    [INFO] [talledLocalContainer]   at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367)
    [INFO] [talledLocalContainer]   at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:214)
    [INFO] [talledLocalContainer]   at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:247)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:196)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:115)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:99)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:281)
    [INFO] [talledLocalContainer]   at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120)
    [INFO] [talledLocalContainer]   at java.lang.Thread.run(Thread.java:595)
    [INFO] [talledLocalContainer] 2010-05-12 09:55:40 [SimpleAsyncTaskExecutor-2] AbstractStep [DEBUG] Step execution complete: StepExecution: id=3, name=staging, status=UNKNOWN, exitStatus=STOPPED, readCount=1, filterCount=0, writeCount=1 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=0, rollbackCount=1
    The weird thing is that even though the status of the step is STOPPED, it runs the next step in the job (the job has no decider and use the default settings).

    Once we switch to Spring 3.0.0.RELEASE, the error goes away.

  2. #2
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    Spring 3.0.2 was a Hibernate 3.5 compatibility release so it might be something to do with that. What version of Hibernate are you using (we supposedly support back to 3.2 I think, but it might be broken in some subtle way)? Does it make a difference if you upgrade?

  3. #3

    Default

    We use 3.3.2. I'll try later to run the test with 3.5

    Do you want me to report this somewhere? It sounds more like a core framework issue but I can only reproduce in a Job.

  4. #4
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    There is a small bug where the Job carries on after it should be stopped (https://jira.springsource.org/browse/BATCH-1567), but only in this scenario where the JobRepository update fails, which should be very rare.

    I tried the JPA samples with Spring 3.0.2 and Hibernate 3.3.2 and it worked, so we will need to get more information before a ticket can be raised (I'm guess against Spring Framework, but hard to say right now).

  5. #5
    Join Date
    Jul 2006
    Location
    Italy
    Posts
    24

    Default Testing framework

    Hi all,

    I have the same error while trying to test a service, and trying to do what is described in the guide

    Code:
    super.countRowsInTable("TABLE_TO_COUNT")
    and this give me
    Code:
    org.hibernate.HibernateException: connnection proxy not usable after transaction completion
    	at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:66)
    	at $Proxy23.createStatement(Unknown Source)
    	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:389)
    	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:455)
    	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:463)
    	at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:471)
    	at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:476)
    	at org.springframework.jdbc.core.JdbcTemplate.queryForInt(JdbcTemplate.java:485)
    	at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForInt(SimpleJdbcTemplate.java:113)
    	at it.omitech.utils.dao.AbstractOmitechTransactionalTests.queryCount(Unknown Source)
    	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)
    ...........
    The environment is Spring 3.0.2, and hibernate 3.5.1-Final.
    It doesn't work with hibernate 3.3.1, but it works with the 3.2.
    Any suggestions?

    I'm forced to use hibernate 3.2....

    thanks

  6. #6
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    Try posting in the Spring Data Access forum (this isn't Batch specific). Spring 3.0.3 will be out soon so you could try a snapshot of that as well.

  7. #7

    Default

    Quote Originally Posted by Dave Syer View Post
    Try posting in the Spring Data Access forum (this isn't Batch specific). Spring 3.0.3 will be out soon so you could try a snapshot of that as well.
    For your information, I tried with Spring 3.0.3 and Spring Batch 2.1.2 and I have the same problem.

  8. #8

    Default

    Spring 3.0.4-BUILD-SNAPSHOT helps thanks to https://jira.springframework.org/browse/SPR-7393 but I still have 6 test cases failing with this version and Spring batch 2.1.2 that are working fine with Spring 2.5.6

    Still investigating.

  9. #9

    Default

    The 6 tests failing seems to be related to the Spring Batch 2.1.0 to 2.1.2. As far as we're concerned this issue will be fixed in Spring 3.0.4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •