You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some circumstances hibernate fails to report a meaningful error message and instead shows a nullpointerexception:
2024-11-21 19:00:18,827 WARN [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator] (JPA Startup Thread) HHH000342: Could not obtain connecti on to query metadata: java.lang.NullPointerException: Cannot throw exception because the return value of "java.util.function.BiFunction.apply(Object, Obj ect)" is null
at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doTheWork(JtaIsolationDelegate.java:202)
at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.lambda$delegateWork$3(JtaIsolationDelegate.java:91)
at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.doInSuspendedTransaction(JtaIsolationDelegate.java:123)
at org.hibernate.resource.transaction.backend.jta.internal.JtaIsolationDelegate.delegateWork(JtaIsolationDelegate.java:88)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.getJdbcEnvironmentUsingJdbcMetadata(JdbcEnvironmentInitiator.java:276)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:107)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:68)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:130)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:238)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:215)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:52)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:136)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:247)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:215)
at org.hibernate.boot.internal.SessionFactoryOptionsBuilder.<init>(SessionFactoryOptionsBuilder.java:276)
at io.quarkus.hibernate.orm.runtime.recording.PrevalidatedQuarkusMetadata.buildSessionFactoryOptionsBuilder(PrevalidatedQuarkusMetadata.java:70)
at io.quarkus.hibernate.orm.runtime.boot.FastBootEntityManagerFactoryBuilder.build(FastBootEntityManagerFactoryBuilder.java:84)
at io.quarkus.hibernate.orm.runtime.FastBootHibernatePersistenceProvider.createEntityManagerFactory(FastBootHibernatePersistenceProvider.java:72)
at jakarta.persistence.Persistence.createEntityManagerFactory(Persistence.java:80)
at jakarta.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at io.quarkus.hibernate.orm.runtime.JPAConfig$LazyPersistenceUnit.get(JPAConfig.java:157)
at io.quarkus.hibernate.orm.runtime.JPAConfig$1.run(JPAConfig.java:64)
at java.base/java.lang.Thread.run(Thread.java:1583)
Keycloak is using a persistence.xml, I'm not sure if that's a requirement to reproduce this. If you then misconfigure the datasource, such as an invalid password, you should see the null pointer exception.
Output of uname -a or ver
No response
Output of java -version
No response
Quarkus version or git rev
3.8.5
Build tool (ie. output of mvnw --version or gradlew --version)
No response
Additional information
No response
The text was updated successfully, but these errors were encountered:
I think the most likely cause would be either the sqlExceptionConverter being passed a null exception (in which case the bug is in whatever called the sqlExceptionConverter), or the sqlExceptionConverter returning null as the "converted" exception (in which case the bug is in the sqlExceptionConverter)
it seems caused by the exception converter returning null, which certainly looks like a bug, possibly caused by this line.
We probably need, at least, to check in Hibernate ORM that sqlExceptionConverter implementations never return null, because I think that would be a bug.
Also, thanks for creating the bug report @shawkins :)
yrodiere
changed the title
NullPointerException from hibernated when there is a problem establishing a connection
NullPointerException from Hibernate ORM when there is a problem establishing a connection
Nov 22, 2024
Describe the bug
In some circumstances hibernate fails to report a meaningful error message and instead shows a nullpointerexception:
See keycloak/keycloak#35181 - this error also appears in other Keycloak and Quarkus issues, such as #31842
Expected behavior
A meaningful exception.
Actual behavior
A nullpointerexception.
How to Reproduce?
Keycloak is using a persistence.xml, I'm not sure if that's a requirement to reproduce this. If you then misconfigure the datasource, such as an invalid password, you should see the null pointer exception.
Output of
uname -a
orver
No response
Output of
java -version
No response
Quarkus version or git rev
3.8.5
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: