Wildfly 16, PostgreSQL datasource not working
akaine Apr 14, 2019 10:03 PMHello,
I've been trying to migrate my existing web application from Wildfly 10 to Wildfly 16 when I encountered a weird problem.
Just to explain what I did to configure the DS and the things involved:
1. Set EclipseLink 2.7.3 as default persistence provider (did it already many times with different Jboss/Wildfly versions without any issues and have several production servers running with it). The process is described here pretty thoroughly: JPA Reference Guide - WildFly 10 - Project Documentation Editor
2. Installed PostgreSQL driver JAR module using CLI:
module add --name=org.postgres --resources=postgresql-42.2.5.jar --dependencies=javax.api,javax.transaction.api
3. Using Web console added a "PostgreSQL" driver pointing to the installed module.
4. Using Web console added a datasource called "testDS". Preliminary testing reported no errors and the server starts without any problems.
However, I noticed the following message during the server start:
20:08:56,072 WARN [org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService$AS7DataSourceDeployer] (MSC service thread 1-3) IJ020020: Connection Properties for DataSource: 'java:/testDS' is empty, try to use driver-class: 'org.postgresql.Driver' and connection-url: 'jdbc:postgresql://localhost:5432/testdb' to connect database
Now when I actually try to connect to my database and run a JPA query I see the following:
20:45:42,149 INFO [org.eclipse.persistence] (default task-1) EclipseLink, version: Eclipse Persistence Services - 2.7.3.v20180807-4be1041 20:45:42,240 INFO [org.eclipse.persistence.connection] (default task-1) connecting(DatabaseLogin( platform=>PostgreSQLPlatform user name=> "" connector=>JNDIConnector datasource name=>null )) 20:45:42,240 INFO [org.eclipse.persistence.connection] (default task-1) Connected: jdbc:postgresql://localhost/ User: postgres Database: PostgreSQL Version: 10.6 Driver: PostgreSQL JDBC Driver Version: 42.2.5 20:45:42,240 INFO [org.eclipse.persistence.connection] (default task-1) connecting(DatabaseLogin( platform=>PostgreSQLPlatform user name=> "" connector=>JNDIConnector datasource name=>null )) 20:45:42,240 INFO [org.eclipse.persistence.connection] (default task-1) Connected: jdbc:postgresql://localhost/ User: postgres Database: PostgreSQL Version: 10.6 Driver: PostgreSQL JDBC Driver Version: 42.2.5 20:45:42,256 WARN [org.eclipse.persistence.metadata] (default task-1) Reverting the lazy setting on the OneToOne or ManyToOne attribute [profile] for the entity class [class com.akaine.test.eb.Employee] since weaving was not enabled or did not occur. 20:45:42,272 INFO [org.eclipse.persistence.connection] (default task-1) /vfs:/E:/_CODE/_SERVER/wildfly-16.0.0.Final-EM/standalone/deployments/wildfly-test.war/WEB-INF/classes/_testPU login successful 20:45:42,365 INFO [org.eclipse.persistence.query] (default task-1) Communication failure detected when attempting to perform read query outside of a transaction. Attempting to retry query. Error was: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.3.v20180807-4be1041): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: org.postgresql.util.PSQLException: ERROR: relation "employee" does not exist
Notice the truncated connection URL after the host. After this, obviously, the rest goes bonkers, since, as I understand, the datasource does not even provide a proper connection to my database.
For the reference, I'm attaching my installed-drivers-list and datasources:read-resource(recursive=true) CLI outputs.
So any idea what may cause this? I've noticed some considerable differences between Wildfly v15 and v16, though the v16 manual says nothing out of the ordinary regarding the datasource creation.
-
cli-output.txt.zip 2.1 KB