Not able to make "Hello hibernate" work

Dear all,
I tried to follow the steps delineated in Hello Hibernate by using

IntelliJ IDEA 2024.2.3 (Community Edition)
Build #IC-242.23339.11, built on September 25, 2024
Runtime version: 21.0.4+13-b509.17 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 10.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 2048M
Cores: 8
Registry:
ide.experimental.ui=true
i18n.locale=
terminal.new.ui=true
Non-Bundled Plugins:
com.intellij.jpa.jpb.model (242.22855.128)
PythonCore (242.23339.11)
com.haulmont.jpab (242.22855.36)
MavenRunHelper (4.29.0-IJ2022.2)
org.intellij.scala (2024.2.28)
Kotlin: 242.23339.11-IJ

The Gradle build is ok, but running the example bombs with the following exception:

> Task :Main.main()
[INFO] HHH000412: Hibernate ORM core version 7.0.0.Beta1
Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] due to: java.lang.NullPointerException: Cannot invoke "java.lang.Class.toString()" because the return value of "io.agroal.api.configuration.AgroalConnectionFactoryConfiguration.connectionProviderClass()" is null
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:276)
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:238)
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:215)
	at org.hibernate.boot.model.relational.Database.<init>(Database.java:45)
	at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:282)
	at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:215)
	at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:221)
	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:197)
	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:152)
	at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:447)
	at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:106)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:946)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:996)
	at Main.main(Main.java:20)
Caused by: org.hibernate.HibernateException: java.lang.NullPointerException: Cannot invoke "java.lang.Class.toString()" because the return value of "io.agroal.api.configuration.AgroalConnectionFactoryConfiguration.connectionProviderClass()" is null
Caused by: org.hibernate.HibernateException: java.lang.NullPointerException: Cannot invoke "java.lang.Class.toString()" because the return value of "io.agroal.api.configuration.AgroalConnectionFactoryConfiguration.connectionProviderClass()" is null

	at org.hibernate.agroal.internal.AgroalConnectionProvider.configure(AgroalConnectionProvider.java:124)
	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.service.ServiceRegistry.requireService(ServiceRegistry.java:68)
	at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:429)
	at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.getJdbcEnvironmentUsingJdbcMetadata(JdbcEnvironmentInitiator.java:300)
	at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:126)
	at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:78)
	at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:130)
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
	... 13 more
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Class.toString()" because the return value of "io.agroal.api.configuration.AgroalConnectionFactoryConfiguration.connectionProviderClass()" is null
	at org.hibernate.agroal.internal.AgroalConnectionProvider.configure(AgroalConnectionProvider.java:115)
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Class.toString()" because the return value of "io.agroal.api.configuration.AgroalConnectionFactoryConfiguration.connectionProviderClass()" is null

	... 23 more

> Task :Main.main() FAILED

Execution failed for task ':Main.main()'.
> Process 'command 'C:\Users\00917831\.jdks\azul-22.0.2\bin\java.exe'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.The same 
BUILD FAILED in 6s
3 actionable tasks: 1 executed, 2 up-to-date

The same exception occurs with the “Hello JPA” example and with other JAKARTA_JDBC_URLs. Nothing changes if I use Hibernate 6.6.
Where did I go wrong?

Thanks in advance

You’re running into a bug that was introduced in Hibernate ORM 6.6.0. It will be fixed in 6.6.2. Also see [HHH-18669] - Hibernate JIRA

1 Like