javax.persistence.TransactionRequiredException

no transaction is in progress

Solutions on the web307

  • no transaction is in progress
  • via Spring JIRA by Manuel Dominguez Sarmiento, 1 year ago
    no transaction is in progress
  • via Kuali JIRA by Mike Riley, 1 year ago
    no transaction is in progress
  • Stack trace

    • javax.persistence.TransactionRequiredException: no transaction is in progress at org.hibernate.jpa.spi.AbstractEntityManagerImpl.checkTransactionNeeded(AbstractEntityManagerImpl.java:1136)[hibernate-entitymanager-5.0.9.Final.jar:5.0.9.Final] at org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1297)[hibernate-entitymanager-5.0.9.Final.jar:5.0.9.Final] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_71] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)[na:1.8.0_71] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)[na:1.8.0_71] at java.lang.reflect.Method.invoke(Unknown Source)[na:1.8.0_71] at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:347)[spring-orm-4.3.2.RELEASE.jar:4.3.2.RELEASE] at com.sun.proxy.$Proxy56.flush(Unknown Source)[na:na] at org.springframework.batch.item.database.JpaItemWriter.write(JpaItemWriter.java:84)[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:175)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.step.item.SimpleChunkProcessor.doWrite(SimpleChunkProcessor.java:151)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.step.item.SimpleChunkProcessor.write(SimpleChunkProcessor.java:274)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:199)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)[spring-tx-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374)[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)[spring-batch-infrastructure-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:200)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:67)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:169)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:134)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:306)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:135)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)[spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:128)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_71] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)[na:1.8.0_71] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)[na:1.8.0_71] at java.lang.reflect.Method.invoke(Unknown Source)[na:1.8.0_71] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:127)[spring-batch-core-3.0.7.RELEASE.jar:3.0.7.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE] at com.sun.proxy.$Proxy63.run(Unknown Source)[na:na] at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.execute(JobLauncherCommandLineRunner.java:216)[spring-boot-autoconfigure-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.executeLocalJobs(JobLauncherCommandLineRunner.java:233)[spring-boot-autoconfigure-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.launchJobFromProperties(JobLauncherCommandLineRunner.java:125)[spring-boot-autoconfigure-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.run(JobLauncherCommandLineRunner.java:119)[spring-boot-autoconfigure-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:798)[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:782)[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:769)[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at es.dmunozfer.example.batch.SpringBatchTwoDatabasesExampleApplication.main(SpringBatchTwoDatabasesExampleApplication.java:12)[classes/:na]

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    Once, 4 months ago
    Unknown user
    Once, 11 months ago
    Unknown user
    Once, 1 year ago
    Unknown user
    Once, 1 year ago
    Unknown user
    2 times, 1 year ago
    2 more bugmates