Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting NullPointerException while using hibernate reactive with any associations (@OneToMany, @ManyToMany, etc.) #16939

Closed
kutchu opened this issue May 2, 2021 · 8 comments
Labels
area/hibernate-reactive Hibernate Reactive area/persistence OBSOLETE, DO NOT USE kind/bug Something isn't working triage/invalid This doesn't seem right

Comments

@kutchu
Copy link

kutchu commented May 2, 2021

Describe the bug

Quarkus Application (version 1.13.3.Final) does not start, and gives NullPointerException when we use hibernate reactive with any hibernate associations.

Expected behavior

The application must start and should be able to create schema.

Actual behavior

2021-05-02 18:49:54,543 ERROR [io.qu.ru.Application] (Quarkus Main Thread) Failed to start application (with profile dev): java.lang.NullPointerException
at org.hibernate.reactive.persister.collection.impl.ReactiveOneToManyPersister.getSQLInsertRowString(ReactiveOneToManyPersister.java:144)
at org.hibernate.persister.collection.AbstractCollectionPersister.logStaticSQL(AbstractCollectionPersister.java:693)
at org.hibernate.persister.collection.AbstractCollectionPersister.(AbstractCollectionPersister.java:529)
at org.hibernate.persister.collection.OneToManyPersister.(OneToManyPersister.java:69)
at org.hibernate.reactive.persister.collection.impl.ReactiveOneToManyPersister.(ReactiveOneToManyPersister.java:52)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.hibernate.persister.internal.PersisterFactoryImpl.createCollectionPersister(PersisterFactoryImpl.java:152)
at org.hibernate.persister.internal.PersisterFactoryImpl.createCollectionPersister(PersisterFactoryImpl.java:140)
at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:225)
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:303)
at org.hibernate.reactive.session.impl.ReactiveSessionFactoryImpl.(ReactiveSessionFactoryImpl.java:33)
at io.quarkus.hibernate.reactive.runtime.boot.FastBootReactiveEntityManagerFactoryBuilder.build(FastBootReactiveEntityManagerFactoryBuilder.java:34)
at io.quarkus.hibernate.reactive.runtime.FastBootHibernateReactivePersistenceProvider.createEntityManagerFactory(FastBootHibernateReactivePersistenceProvider.java:83)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:80)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at io.quarkus.hibernate.orm.runtime.JPAConfig$LazyPersistenceUnit.get(JPAConfig.java:118)
at io.quarkus.hibernate.orm.runtime.JPAConfig.startAll(JPAConfig.java:42)
at io.quarkus.hibernate.orm.runtime.JPAConfig_Subclass.startAll$$superaccessor5(JPAConfig_Subclass.zig:763)
at io.quarkus.hibernate.orm.runtime.JPAConfig_Subclass$$function$$5.apply(JPAConfig_Subclass$$function$$5.zig:29)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:63)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:51)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at io.quarkus.hibernate.orm.runtime.JPAConfig_Subclass.startAll(JPAConfig_Subclass.zig:721)
at io.quarkus.hibernate.orm.runtime.HibernateOrmRecorder.startAllPersistenceUnits(HibernateOrmRecorder.java:88)
at io.quarkus.deployment.steps.HibernateOrmProcessor$startPersistenceUnits951856026.deploy_0(HibernateOrmProcessor$startPersistenceUnits951856026.zig:74)
at io.quarkus.deployment.steps.HibernateOrmProcessor$startPersistenceUnits951856026.deploy(HibernateOrmProcessor$startPersistenceUnits951856026.zig:40)
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:762)
at io.quarkus.runtime.Application.start(Application.java:90)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:100)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.runner.bootstrap.StartupActionImpl$3.run(StartupActionImpl.java:134)
at java.base/java.lang.Thread.run(Thread.java:834)

To Reproduce

  1. Set up a mysql server at local machine.
  2. Start the below quarkus code in dev mode .
./mvnw compile quarkus:dev

sample-quarkus.zip

Configuration

# Add your application.properties here, if applicable.

Screenshots

(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

Output of uname -a or ver

Output of java -version

openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing)

GraalVM version (if different from Java)

GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06)

Quarkus version or git rev

Build tool (ie. output of mvnw --version or gradlew --version)

Additional context

If we use quarkus version 1.12.2.Final, atleast the application gets started and is able to create schema. But it fails in version 1.13 onwards.

@kutchu kutchu added the kind/bug Something isn't working label May 2, 2021
@quarkus-bot quarkus-bot bot added area/hibernate-reactive Hibernate Reactive area/persistence OBSOLETE, DO NOT USE labels May 2, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented May 2, 2021

/cc @DavideD, @Sanne, @gavinking

@DavideD
Copy link
Contributor

DavideD commented May 2, 2021 via email

@DavideD
Copy link
Contributor

DavideD commented May 2, 2021 via email

@DavideD
Copy link
Contributor

DavideD commented May 2, 2021 via email

@kutchu
Copy link
Author

kutchu commented May 3, 2021

@DavideD Thank you for the workaround. It works after setting log level to "INFO". Can you please let me know when this would get fixed, as sometimes "DEBUG" log is important for debugging?

@DavideD
Copy link
Contributor

DavideD commented May 3, 2021 via email

@gwenneg
Copy link
Member

gwenneg commented May 3, 2021

There is a partial workaround for this bug:

quarkus.log.category."org.hibernate".level=DEBUG
quarkus.log.category."org.hibernate.reactive.persister".level=INFO

I am not sure about the exact package that needs to log at INFO level though, it might not be org.hibernate.reactive.persister. But I know this or something very close worked for me.

@Sanne Sanne added the triage/invalid This doesn't seem right label May 4, 2021
@Sanne
Copy link
Member

Sanne commented May 4, 2021

I'll close it as it's a duplicate of #16712

Thanks!

@Sanne Sanne closed this as completed May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-reactive Hibernate Reactive area/persistence OBSOLETE, DO NOT USE kind/bug Something isn't working triage/invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

4 participants