7 Replies Latest reply on Oct 15, 2013 4:37 PM by paul_alesius

    JDBC driver in EAR does not work with Wildfly

    paul_alesius

      I put the jdbc driver in earname.ear/lib/ and try to use it in the jboss-ds.xml. This has worked before but none of the declarations work in wildfly 8.

       

      I've tried:

      <driver>earname.ear</driver>

      <driver>earname.ear_postgresql-9.2-1003-jdbc4.jar</driver>

      <driver>earname.earpostgresql-9.2-1003-jdbc4.jar</driver>

      <driver>postgresql-9.2-1003-jdbc4.jar</driver>

      etc..

       

      None work. Please assist.

       

      Thank you.

        • 1. Re: JDBC driver in EAR does not work with Wildfly
          lafr

          When deploying your ear, you see something similar to

          06:32:03,728 INFO  [org.jboss.as.connector.deployers.jdbc#start] JBAS010417: Started Driver service with driver-name = ojdbc6.jar ?

          There is the name of the driver to use.

          If not, the problem might be, that the driver inside ear is not recognized.

          • 2. Re: JDBC driver in EAR does not work with Wildfly
            paul_alesius

            Nope, not with pgsql, I see that only when deploying the driver separately from the ear. I want it inside the ear.

             

            There's this bug where they supposedly fixed it but FML I can't get it to work, and it has worked before on jboss as 7.1.

             

            [WFLY-1269] single jdbc driver deployed inside ear takes name of ear - JBoss Issue Tracker

            • 3. Re: JDBC driver in EAR does not work with Wildfly
              lafr

              So you already know how to find out the real name.

              My ear file is named hgm2e-langfr-sb2000-ipc.ear and now temporary contains postgresql-9.2-1003.jdbc4.jar in lib folder.

              Using current WildFly 8.0.0-Beta2-SNAPSHOT the resulting name is then hgm2e-langfr-sb2000-ipc.ear_org.postgresql.Driver_9_2 as you can see:

              {
              "driver-name" => "hgm2e-langfr-sb2000-ipc.ear_org.postgresql.Driver_9_2",
              "deployment-name" => "hgm2e-langfr-sb2000-ipc.ear_org.postgresql.Driver_9_2",
              "driver-module-name" => undefined,
              "module-slot" => undefined,
              "driver-datasource-class-name" => undefined,
              "driver-xa-datasource-class-name" => undefined,
              "driver-class-name" => "org.postgresql.Driver",
              "driver-major-version" => 9,
              "driver-minor-version" => 2,
              "jdbc-compliant" => false
              }
              • 4. Re: JDBC driver in EAR does not work with Wildfly
                paul_alesius

                Thanks for the reply.

                 

                If I look into the dir wildfly/standalone/deployments, I see the directoy: "com.mycompany.ear".

                The driver jar exists in wildfly/standalone/deployments/com.mycompany.ear/lib/postgresql-9.2-1003-jdbc4.jar

                 

                This would imply that in jboss-ds.xml, the <xa-datasource> <driver> definition should look as such:

                <driver>com.mycompany.ear_org.postgresql.Driver_9_2</driver>

                 

                This does not work, and I get:

                JBAS014775:    New missing/unsatisfied dependencies:

                                 service jboss.jdbc-driver.com_mycompany_ear_org_postgresql_Driver_9_2 (missing) dependents: [service jboss.data-source.java:jboss/datasources/myxadatasource]

                 

                It looks like a bug to me, I don't get how they managed to get it to work in that bug report.

                 

                Also, how do you list the drivers in the ear to get that info?

                 

                Thank you.

                • 5. Re: JDBC driver in EAR does not work with Wildfly
                  lafr

                  As written in the mentioned JIRA.

                  Use jboss-cli.sh (.bat) (e.g. jboss-cli.sh --controller=localhost:9990 --connect). Then "/subsystem=datasources:installed-drivers-list".

                   

                  And as already said, you should see messages like these from my test yesterday evening:

                  14.10. 22:42:30,578 INFO  [org.jboss.as.connector.deployers.jdbc#deploy] JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.2)

                  ...

                  14.10. 22:42:39,900 INFO  [org.jboss.as.connector.deployers.jdbc#start] JBAS010417: Started Driver service with driver-name = hgm2e-langfr-sb2000-ipc.ear_org.postgresql.Driver_9_2

                  As long as you do not get such messages the driver is not deployed.

                   

                  With exploded deployments (ear / war) there have been some problems in the past, behaving different then a deployed file ear file. Could you build an ear file and deploy this instead of ear directory?

                  • 6. Re: Re: JDBC driver in EAR does not work with Wildfly
                    paul_alesius

                    Thanks for the reply.

                     

                    You're right! When I deploy it as a packaged EAR, it finds the driver:

                    (MSC service thread 1-5) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.2)

                     

                    When I deploy in eclipse during development, it is never found and I get missing dependency warning. This is ofc. problematic for development. I created a simple empty ear, and added postgre dependency to it.

                     

                    Filing a bug report.