5 Replies Latest reply on Jun 26, 2008 10:28 AM by klapcio

    [JBoss 4.2.2GA]Problem with PostgreSQL as DefaultDS

    klapcio

      Hi all,

      After editing postgres-ds.xml in deploy direcotry and mapping Postgres as DefaultDS in standardjbosscmp-jdbc.xml and putting the JDBC jar drivers in the lib directory I'm still getting connection problems:

      WARN [JBossManagedConnectionPool] Throwable while attempting to ge
      t a new connection: null
      org.jboss.resource.JBossResourceException: Could not create connection; - nested
       throwable: (org.jboss.resource.JBossResourceException: Apparently wrong driver
      class specified for URL: class: org.postgresql.Driver, url: jdbc:postgresql://[s
      ervername]:[port]/[database name])
      


      ..and much more exceptions from JBoss ...

      Any solutions ?

        • 1. Re: [JBoss 4.2.2GA]Problem with PostgreSQL as DefaultDS
          jaikiran

          What does your datasource file look like? And also which jars did you copy to the server/< serverName>/lib folder?

          • 2. Re: [JBoss 4.2.2GA]Problem with PostgreSQL as DefaultDS
            klapcio

             

            "jaikiran" wrote:
            What does your datasource file look like? And also which jars did you copy to the server/< serverName>/lib folder?


            My postgres-ds.xml looks:
            <?xml version="1.0" encoding="UTF-8"?>
            
            <!-- Datasource config for Postgres -->
            
            <datasources>
             <local-tx-datasource>
             <jndi-name>DefaultDS</jndi-name>
             <connection-url>jdbc:postgresql://[servername]:[port]/[database name]</connection-url>
             <driver-class>org.postgresql.Driver</driver-class>
             <user-name>jboss</user-name>
             <password>jboss</password>
             <!-- sql to call when connection is created. Can be anything, select 1 is valid for PostgreSQL
             <new-connection-sql>select 1</new-connection-sql>
             -->
            
             <!-- sql to call on an existing pooled connection when it is obtained from pool. Can be anything, select 1 is valid for PostgreSQL
             <check-valid-connection-sql>select 1</check-valid-connection-sql>
             -->
            
             <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
             <metadata>
             <type-mapping>PostgreSQL 8.0</type-mapping>
             </metadata>
             </local-tx-datasource>
            
            </datasources>
            


            I copied postgresql-8.1-412.jdbc3.jar into lib directory (I'm using PostgreSQL 8.1.11 on Solaris10)

            A DB connection with psql client works fine

            • 3. Re: [JBoss 4.2.2GA]Problem with PostgreSQL as DefaultDS
              jaikiran

               

              <connection-url>jdbc:postgresql://[servername]:[port]/[database name]</connection-url>


              This is incorrect. You have replace the servername, port, database with the actual values corresponding to your database server.

              • 4. Re: [JBoss 4.2.2GA]Problem with PostgreSQL as DefaultDS
                klapcio

                 

                "jaikiran" wrote:
                <connection-url>jdbc:postgresql://[servername]:[port]/[database name]</connection-url>


                This is incorrect. You have replace the servername, port, database with the actual values corresponding to your database server.


                I'm so silly...
                OK, the connection is working but I'm still getting ERRORS:

                WARN [ServiceController] Problem starting service jboss.mq:service
                =PersistenceManager
                org.jboss.mq.SpyJMSException: Could not resolve uncommited transactions. Messag
                e recovery may not be accurate; - nested throwable: (org.postgresql.util.PSQLExc
                eption: ERROR: syntax error at or near "TXID")
                


                OK, probably I've to remove hsqldb-jdbc2-service.xml and hsqldb-jdbc2-service.xml from deploy/jms but what shall I put instead of them ?

                • 5. Re: [JBoss 4.2.2GA]Problem with PostgreSQL as DefaultDS
                  klapcio

                  OK, now everything is working

                  In deploy/jms I had only:

                  - rename hsqldb-jdbc-state-service.xml into jbossmq-destinations-service.xml
                  - copy postgres-jdbc2-service.xml form $JBOSS_HOME/docs/examples/jms into deploy/jms and lightly adapt it.