Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-16751

(postgresql) JPA application deployment classloader is missing the org.postgresql JDBC driver classes

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • JPA / Hibernate
    • None
    • ---
    • ---

      Reported initially by jdenise@redhat.com as a recent regression that seemed to come in with our big bang changes to support EE 10 in WildFly 27.

      https://gist.github.com/jfdenise/ae5310a1e712847c67de8cf7faf2e968 shows the failure:

      Caused by: java.lang.ClassNotFoundException: org.postgresql.util.PGobject from [Module "org.hibernate" version 6.0.2.Final from local module loader @5dd91bca (finder: local module finder @40cb698e (roots: work/quickstart/ejb-txn-remote-call/server1/modules,work/quickstart/ejb-txn-remote-call/server1/modules/system/layers/base))]
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:200)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
      at java.base/java.lang.Class.forName0(Native Method)
      at java.base/java.lang.Class.forName(Class.java:398)
      at org.hibernate@6.0.2.Final//org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:163)
      at org.hibernate@6.0.2.Final//org.hibernate.dialect.PostgreSQLPGObjectJdbcType.<clinit>(PostgreSQLPGObjectJdbcType.java:41)

      To recreate it I used the WildFly quickstart project (somewhat as quickstarts need changes for EE 10 still).

      Following the quickstart/ejb-txn-remote-call/README.adoc instructions (mostly), I did:

      1. cd quickstart/ejb-txn-remote-call
      2. export jbossHomeName=~/work/wildfly/dist/target/wildfly-27.0.0.Alpha4-SNAPSHOT
      3. cp -r ${jbossHomeName} server1
      4. ./bin/jboss-cli.sh "embed-server, module add --name=org.postgresql.jdbc --module-xml=~work/quickstart/ejb-txn-remote-call/client/extensions/postgresql-module.xml"
      5. ./bin/jboss-cli.sh "embed-server --server-config=standalone.xml,/subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=org.postgresql.jdbc,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)"
      6. ./bin/standalone.sh -c standalone.xml -Djboss.tx.node.id=server1 -Djboss.node.name=server1 -Dwildfly.config.url=~/work/quickstart/ejb-txn-remote-call/client/configuration/custom-config.xml
      7. (in quickstart/ejb-txn-remote-call), ran `mvn clean install`
      8. Extracted the contents of the quickstart/ejb-txn-remote-call/client/target/client.war file and created a minimal test.jar which is attached to this issue. The test.jar only has a persistence.xml that should be helpful in recreating the problem by copying the test.jar to your (already setup for psql) server1/standalone/deployments folder.
      9. ./bin/standalone.sh -c standalone.xml -Djboss.tx.node.id=server1 -Djboss.node.name=server1 -Dwildfly.config.url=~/work/quickstart/ejb-txn-remote-call/client/configuration/custom-config.xml

              smarlow1@redhat.com Scott Marlow
              smarlow1@redhat.com Scott Marlow
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: