Created
March 21, 2022 18:56
-
-
Save scottmarlow/74c44524e78a66febdeddf8d0cdb267f to your computer and use it in GitHub Desktop.
Do Hibernate 6.0 (Java SE) applications deployed on WildFly need to supply 'javax.persistence.jdbc.url', 'hibernate.connection.url', or 'hibernate.dialect'?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Running the WildFly org.jboss.as.test.integration.hibernate.Hibernate4NativeAPIProviderTestCase test with | |
recent local ORM 6 (main branch) build is getting the below deployment failure. | |
The test code link is | |
https://github.com/wildfly/wildfly/blob/main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/hibernate/Hibernate4NativeAPIProviderTestCase.java#L54 | |
The linked Hibernate4NativeAPIProviderTestCase does not set any of the following (if we did the test might pass): | |
javax.persistence.jdbc.url | |
hibernate.connection.url | |
hibernate.dialect | |
Note that the linked Hibernate4NativeAPIProviderTestCase.java inlines the Hibernate ORM configuration/mapping files. | |
Test deployment failure: | |
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:267) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:230) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.boot.model.relational.Database.<init>(Database.java:44) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:216) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:189) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:132) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:91) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:402) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:90) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:727) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:765) | |
at deployment.hibernateSecondLevel_test.ear.beans.jar//org.jboss.as.test.integration.hibernate.secondlevelcache.SFSB.setupConfig(SFSB.java:70) | |
... 209 more | |
Caused by: org.hibernate.HibernateException: Unable to determine Dialect without JDBC metadata (please set 'javax.persistence.jdbc.url', 'hibernate.connection.url', or 'hibernate.dialect') | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:147) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:60) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:244) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:36) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:100) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:255) | |
... 221 more | |
If I add <property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property> to the unit test, I then see the below failure "The application must supply JDBC connections": | |
Caused by: java.lang.RuntimeException: Could not setup config | |
at deployment.hibernate4native_test.ear.beans.jar//org.jboss.as.test.integration.hibernate.SFSBHibernateSessionFactory.setupConfig(SFSBHibernateSessionFactory.java:79) | |
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 org.jboss.as.ee@27.0.0.Beta1-SNAPSHOT//org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52) | |
at org.jboss.invocation@1.7.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422) | |
at org.jboss.invocation@1.7.0.Final//org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:509) | |
at org.jboss.as.weld.common@27.0.0.Beta1-SNAPSHOT//org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.delegateInterception(Jsr299BindingsInterceptor.java:79) | |
at org.jboss.as.weld.common@27.0.0.Beta1-SNAPSHOT//org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:89) | |
at org.jboss.as.weld.common@27.0.0.Beta1-SNAPSHOT//org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:102) | |
at org.jboss.as.ee@27.0.0.Beta1-SNAPSHOT//org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63) | |
at org.jboss.invocation@1.7.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422) | |
at org.jboss.as.ejb3@27.0.0.Beta1-SNAPSHOT//org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43) | |
at org.jboss.invocation@1.7.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422) | |
at org.jboss.as.jpa@27.0.0.Beta1-SNAPSHOT//org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47) | |
at org.jboss.invocation@1.7.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422) | |
at org.jboss.as.jpa@27.0.0.Beta1-SNAPSHOT//org.jboss.as.jpa.interceptor.SFSBInvocationInterceptor.processInvocation(SFSBInvocationInterceptor.java:57) | |
at org.jboss.invocation@1.7.0.Final//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422) | |
at org.jboss.as.ejb3@27.0.0.Beta1-SNAPSHOT//org.jboss.as.ejb3.tx.StatefulBMTInterceptor.handleInvocation(StatefulBMTInterceptor.java:94) | |
... 189 more | |
Caused by: java.lang.UnsupportedOperationException: The application must supply JDBC connections | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.engine.jdbc.connections.internal.UserSuppliedConnectionProviderImpl.getConnection(UserSuppliedConnectionProviderImpl.java:44) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:284) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:41) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.jdbcStatement(GenerationTargetToDatabase.java:77) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:53) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:419) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:403) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:272) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:178) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:149) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:117) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:242) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.lambda$process$5(SchemaManagementToolCoordinator.java:143) | |
at java.base/java.util.HashMap.forEach(HashMap.java:1336) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:140) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:333) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:415) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:746) | |
at org.hibernate@6.0.0-SNAPSHOT//org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:765) | |
at deployment.hibernate4native_test.ear.beans.jar//org.jboss.as.test.integration.hibernate.SFSBHibernateSessionFactory.setupConfig(SFSBHibernateSessionFactory.java:77) | |
... 208 more |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment