JetBrains / Exposed

Kotlin SQL Framework
http://jetbrains.github.io/Exposed/
Apache License 2.0
8.36k stars 695 forks source link

Specified transaction manager is not a ReactiveTransactionManager #661

Open Blackdread opened 5 years ago

Blackdread commented 5 years ago

I use

Get this error when moving from spring-boot-starter-parent 2.1.9.RELEASE to 2.2.0.RELEASE.

I get this error when calling a method in a @Service class and is annotated with @Async and @Transactional

For some reason Spring determines that it should use a ReactiveTransactionManager but I do not use any reactive features like Mono, Flux, Flow. And no dependency to reactor in maven, etc.

java.lang.IllegalStateException: Specified transaction manager is not a ReactiveTransactionManager: org.jetbrains.exposed.spring.SpringTransactionManager@4053cfd5
    at org.springframework.transaction.interceptor.TransactionAspectSupport$ReactiveTransactionSupport.asReactiveTransactionManager(TransactionAspectSupport.java:957)
    at org.springframework.transaction.interceptor.TransactionAspectSupport$ReactiveTransactionSupport.determineTransactionManager(TransactionAspectSupport.java:929)
    at org.springframework.transaction.interceptor.TransactionAspectSupport$ReactiveTransactionSupport.invokeWithinTransaction(TransactionAspectSupport.java:848)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:335)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:99)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747)
    at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
    at org.springframework.aop.interceptor.AsyncExecutionAspectSupport.lambda$doSubmit$3(AsyncExecutionAspectSupport.java:276)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run$$$capture(CompletableFuture.java:1771)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java)
    at com.stey.finance.rerent.config.async.AsyncConfiguration$addMetadataInTaskExecutor$1$1$1.run(AsyncConfiguration.kt:30)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:835)
Tapac commented 5 years ago

@Blackdread , i'm not very aware of Spring Boot and Async annotation, but I was trying to reproduce your case without a success.

Could you check that commit 15da8f20 and tell me what to fix to fail the test?

Blackdread commented 5 years ago

See https://github.com/JetBrains/Exposed/pull/676

Because it finds some reactive class on the classpath, it then decides to use reactive transaction manager. So maybe exposed transaction manager should support reactive and non reactive, or then should force spring to not use reactive transaction manager. In my project I have webflux dependency because I use WebClient and get this error with Exposed.

Tapac commented 5 years ago

Sorry, but it looks like it can't be fixed easily as ReactiveTransactionManager highly depends to Reactor api and should be implemented after implementing #456 . That issue is in a roadmap.