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

Hibernate ORM startup failure (HHH000342) when using dev services and the datasource and PU name are different #26507

Closed
yrodiere opened this issue Jul 1, 2022 · 1 comment · Fixed by #26815
Assignees
Labels
area/hibernate-orm Hibernate ORM area/persistence OBSOLETE, DO NOT USE kind/bug Something isn't working
Milestone

Comments

@yrodiere
Copy link
Member

yrodiere commented Jul 1, 2022

Describe the bug

If I change the configuration of the Hibernate ORM quickstart to this, then mvn clean test still works fine:

quarkus.hibernate-orm."DB1".datasource=DB1
quarkus.hibernate-orm."DB1".packages=org.acme.hibernate.orm
quarkus.hibernate-orm."DB1".database.generation=drop-and-create

quarkus.datasource."DB1".db-kind=postgresql
quarkus.datasource."DB1".username=user2
quarkus.datasource."DB1".password=password2

But! Change the datasource name to DB2, and all hell breaks loose:

quarkus.hibernate-orm."DB1".datasource=DB2
quarkus.hibernate-orm."DB1".packages=org.acme.hibernate.orm
quarkus.hibernate-orm."DB1".database.generation=drop-and-create

quarkus.datasource."DB2".db-kind=postgresql
quarkus.datasource."DB2".username=user2
quarkus.datasource."DB2".password=password2
2022-07-01 15:30:57,740 INFO  [io.qua.dev.pos.dep.PostgresqlDevServicesProcessor] (build-3) Dev Services for PostgreSQL started.
2022-07-01 15:30:57,744 INFO  [io.qua.dat.dep.dev.DevServicesDatasourceProcessor] (build-3) Dev Services for  datasource 'DB2' (postgresql) started.
2022-07-01 15:30:58,513 WARN  [io.agr.pool] (agroal-11) Datasource 'DB2': FATAL: password authentication failed for user "user2"
2022-07-01 15:30:58,514 WARN  [org.hib.eng.jdb.env.int.JdbcEnvironmentInitiator] (JPA Startup Thread: DB1) HHH000342: Could not obtain connection to query metadata: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "user2"
        at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:646)
        at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:180)
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:235)
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
        at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:223)
        at org.postgresql.Driver.makeConnection(Driver.java:402)
        at org.postgresql.Driver.connect(Driver.java:261)
        at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:226)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:535)
        at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:516)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

2022-07-01 15:30:58,654 WARN  [io.agr.pool] (agroal-11) Datasource 'DB2': FATAL: password authentication failed for user "user2"
2022-07-01 15:30:58,654 WARN  [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: DB1) SQL Error: 0, SQLState: 28P01
2022-07-01 15:30:58,654 ERROR [org.hib.eng.jdb.spi.SqlExceptionHelper] (JPA Startup Thread: DB1) FATAL: password authentication failed for user "user2"

Expected behavior

The behavior of Quarkus should not depend on whether the persistence unit and datasource have the same name.

Actual behavior

The behavior of Quarkus depends on whether the persistence unit and datasource have the same name.

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

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

No response

Additional information

Evidently, there's something wrong: somewhere, we use the datasource name where we should be using the persistence unit name (or vice-versa).

@yrodiere yrodiere added the kind/bug Something isn't working label Jul 1, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 1, 2022

/cc @stuartwdouglas

@yrodiere yrodiere added area/persistence OBSOLETE, DO NOT USE area/hibernate-orm Hibernate ORM and removed area/devservices labels Jul 1, 2022
@yrodiere yrodiere changed the title Startup failure (HHH000342) when using dev services and the datasource and PU name are different Hibernate ORM startup failure (HHH000342) when using dev services and the datasource and PU name are different Jul 1, 2022
@yrodiere yrodiere self-assigned this Jul 4, 2022
@quarkus-bot quarkus-bot bot added this to the 2.12 - main milestone Jul 20, 2022
@gsmet gsmet modified the milestones: 2.12 - main, 2.11.1.Final Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-orm Hibernate ORM area/persistence OBSOLETE, DO NOT USE kind/bug Something isn't working
Projects
None yet
2 participants