Error instantiating bean of type [io.micronaut.configuration.hibernate.jpa.TransactionalSession$Intercepted]

Viewed 5586

Im new to micronnaut I am trying to include the following to run native queries, the application runs all fine, however all my functional test(s) annotated with @MincronautTest fails with the following message

Message: No bean of type [org.hibernate.SessionFactory] exists for the given qualifier: @Named('default'). Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor)

open class IdGeneratorImpl() : IdGenerator {

@PersistenceContext
private var entityManager: EntityManager? = null

open fun IdGeneratorImpl(@CurrentSession entityManager: EntityManager?) {
    this.entityManager = entityManager
}

the application also has included the following dependencies

implementation "io.micronaut.configuration:micronaut-hibernate jpa:2.0.0.M1"

implementation "io.micronaut.data:micronaut-data-hibernate-jpa:2.0.0.M2"

1 Answers

Update I have raised this issue with micronaut, as after some playing around, it appears to be tied into the kotlin implementation of micronaut data


Have you tried commenting out implementation "io.micronaut.configuration:micronaut-hibernate jpa:2.0.0.M1" in your build.gradle file?

It might work in your case, but can't be 100% certain.

I'm also hitting the same issue, also using micronaut, kotlin & jpa which has had me stuck for a few days.

Maybe give it a try? I'll check back here if I find any solutions.

Related