2 Replies Latest reply on Jul 10, 2019 5:14 AM by pmenage

    java.lang.ClassNotFoundException: org.postgresql.Driver

    pmenage

      Hi Everybody,

       

      I am new to Wildfly / postgresql development. I tried to develop a small java application connecting to a postgresql database which works correctly. I moved the code in a EJB project running on WildFly 16. I add the module.xml file and changed the standalone.xml file as I found on various websites. The EJB project is successfully installed on WildFlly. But when I run a java application calling the EJB, I got error:

      WFLYEJB0442: Unexpected Error

      ......

      Caused by: java.lang.NoClassDefFoundError: org/postgresql/Driver

      ......

      Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver from [Module "deployment.MyEjb.jar" from Service Module Loader]

       

      the content of module.xml is :

      <?xml version="1.0" encoding="utf-8" ?>

      <module xmlns="urn:jboss:module:1.3" name="org.postgresql">

          <resources>

          <!--the name of your driver -->

              <resource-root path="postgresql-42.2.6.jar"/>

          </resources>

          <dependencies>

              <module name="javax.api"/>

              <module name="javax.transaction.api"/>

          </dependencies>

      </module>

       

      Seems simple, but not for me even after several days of battle.

       

      Patrick