4 Replies Latest reply on Jun 29, 2011 11:15 AM by oourfali

    using postgresql driver in as7

    oourfali

      Hello,

       

      I want to deploy the postgresql jdbc driver, so I downloaded a driver that supports jdbc4 from http://jdbc.postgresql.org/download.html

      (the version I used is 9.0-801 JDBC 4 )

       

      I added a datasource entry in standalone.xml, and also a driver entry there.

       

      On startup, I get the following errors:

       

      16:27:54,850 ERROR [org.jboss.as.server] Boot update failed: "Failed to load module for driver [org.postgresql.Driver]"

       

      and afterwards:

       

      16:27:58,353 INFO  [org.jboss.as.server] (MSC service thread 1-1) Service status report

         New missing/unsatisfied dependencies:

            service jboss.jdbc-driver.____________________________ (missing) required by [service jboss.data-source.java:/DataSource]

       

      I followed the manual in https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7

      and http://community.jboss.org/wiki/DataSourceConfigurationinAS7

      in order to add that jdbc driver.

       

      I made sure I have the META-INF/services/java.sql.Driver in the jar, and I put the jar in the deployments directory.

      (Before trying version 9.0-801 I tried an older version that didn't contain the file above, so I used the manual to add the file, but it didn't help).

       

      Are you familiar with some kind of problem with the postgresql driver with AS7?

       

      A working postgresql-as7 configuration sample will be helpful.

       

      Thank you,

      Oved

        • 1. Re: using postgresql driver in as7
          juergen.zimmermann

          I'm using PG 9.1beta2, and the driver 9.1 since 2 or 3 weeks. There are no problems. What did you exactly do:

          a) Deployment of the driver or provisioning as a module?

          b) What exactly are your modifications in standalone.xml?

          • 2. Re: using postgresql driver in as7
            oourfali

            I used provisioning.

             

            I made the following modifications to standalone.xml:

             

            under datasources:

             

                       <datasource jndi-name="java:/DataSource" pool-name="DataSource" enabled="true" use-java-context="true">
                            <connection-url>
                                jdbc:postgresql://10.35.1.30:5432/db
                            </connection-url>
                            <driver-class>
                                org.postgresql.Driver
                            </driver-class>
                            <driver>
                                postgresql-9.0-801.jdbc4.jar
                            </driver>
                            <transaction-isolation>
                                TRANSACTION_READ_COMMITTED
                            </transaction-isolation>
                            <pool>
                                <min-pool-size>
                                    1
                                </min-pool-size>
                                <max-pool-size>
                                    100
                                </max-pool-size>
                                <prefill>
                                    true
                                </prefill>
                                <use-strict-min>
                                    false
                                </use-strict-min>
                            </pool>
                            <security>
                                <user-name>
                                    postgres
                                </user-name>
                                <password>

            password

                                </password>
                            </security>
                            <validation>
                                <validate-on-match>
                                    false
                                </validate-on-match>
                                <background-validation>
                                    false
                                </background-validation>
                                <useFastFail>
                                    false
                                </useFastFail>
                            </validation>
                            <statement>
                                <prepared-statement-cache-size>
                                    100
                                </prepared-statement-cache-size>
                                <share-prepared-statements/>
                            </statement>
                        </datasource>

             

            and under drivers:

             

            <driver name="postgresql-9.0-801.jdbc4.jar" module="org.postgresql.Driver"/>

            • 3. Re: using postgresql driver in as7
              juergen.zimmermann

              This is my module.xml:

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

                    <module xmlns="urn:jboss:module:1.0" name="org.postgresql">
                       <resources>
                          <resource-root path="postgresql.jar"/>
                       </resources>

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

              This is my datasource section

                    <datasource jndi-name="java:/swe1DS" pool-name="swe1DS">
                       <connection-url>jdbc:postgresql:jbossdb</connection-url>
                       <driver>postgresql</driver>
                       <security>
                          <user-name>...</user-name>
                          <password>...</password>
                       </security>
                       <pool>
                          <min-pool-size>1</min-pool-size>
                          <max-pool-size>4</max-pool-size>
                       </pool>
                       <validation>
                         <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>

               

                       </validation>
                    </datasource>

              ...

                    <driver name="postgresql" module="org.postgresql">
                       <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
                    </driver>

              I defined the XA datasource class because I also had problems before. I don't have the driver class declaration inside the datasource section.

              • 4. Re: using postgresql driver in as7
                oourfali

                As a module it indeed worked.

                 

                Thank you,

                Oved