java-spring-cloud
java-spring-cloud copied to clipboard
Adding spring-data-starter-data-jpa with ddl-auto=update causes block at startup
I had posted this issue to wavefront-spring-boot project, but it was identified that there was an issue with Open Tracing. See issue https://github.com/wavefrontHQ/wavefront-spring-boot/issues/27
When I choose to do jpa.hibernate.ddl-auto=update then I get a deadlock during initialization.
I have this dependency included.
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-cloud-starter</artifactId>
<version>0.5.3</version>
</dependency>
Per Stephane.
That's an issue when the EntityManager is bootstrapped asynchronously and OpenTracing is used. If I remove the open tracing starter, the application runs fine.
In the meantime, you can force the bootstrap of JPA in the same thread by adding the following to application.properties:
spring.data.jpa.repositories.bootstrap-mode=default It looks like opentracing is wrapping the DataSource too aggressively as the proxy contains an aspect that hasn't been initialized yet.
I have a very similar issue - if not the same. My workaround was to set opentracing.spring.cloud.async.enabled
to false
. I wonder if that helps with your use-case, too @doddatpivotal ?
Both excluding the starter or disabling certain options are not really nice workarounds though. So a +1 from me for actually tackling the problem.
@dreis2211 I had been working on a demo that has come and gone, so I don't have the code running again to test. But good to know there are multiple workaround and hope the problem gets tackled.