3 Replies Latest reply on Apr 12, 2012 10:07 AM by peterj

    jboss 5.1.GA connection issue with postgresql 8.4

    vaishu09

      migrating the project from jboss 4 to jboss 5.1.0 GA. java version - jdk 1.6.0_13. database - postgresql 8.4.

       

      jboss 5.1 starts without error. i copied the postgres-ds.xml to server/default/deploy.

       

      then deployed the apllication and there were no deployment issues.

       

      But once i hit my site, it throws Null Pointer Exception at the point where it calls the Database. During database connection it does not throw any exception. When i print the connection, i get 'org.postgresql.jdbc4.Jdbc4Connection@1a1faec'. Not sure what steps to be followed to connect to the database.

       

      I have attached the entire server.log file.

       

      Thanks in Advance.

        • 1. Re: jboss 5.1.GA connection issue with postgresql 8.4
          wdfink

          It might not a problem with the DS.

           

          What code is here => ViewClimateHomeAction.java:108?

          What you use? EJB2.x or EJB3. Entities or direct SQL?

           

          Give us a little more detail to helping you.

          • 2. Re: jboss 5.1.GA connection issue with postgresql 8.4
            vaishu09

            ViewClimateHomeAction.java is the java file, the point at which the database is called. We use direct SQL. The same application is working in JBoss 4. but it is not working in JBoss 5.1.0.

             

            Other than copying the postgres-ds.xml file to server/default/deploy folder and added postgresql-8.4-702.jdbc4.jar to server/default/lib folder, is there any steps to configure the databse?

             

            I have attached the postgres-ds.xml file also.

             

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

            <!-- ===================================================================== -->

            <!-- -->

            <!-- JBoss Server Configuration -->

            <!-- -->

            <!-- ===================================================================== -->

            <!-- See http://www.jboss.org/community/wiki/Multiple1PC for information about local-tx-datasource -->

            <!-- $Id: postgres-ds.xml 88948 2009-05-15 14:09:08Z jesper.pedersen $ -->

            <!-- ==================================================================== -->

            <!-- Datasource config for Postgres -->

            <!-- ==================================================================== -->

             

            <datasources>

            <local-tx-datasource>

            <jndi-name>CLIMATEPARLIAMENT_APP_DS</jndi-name>

            <connection-url>jdbc:postgresql://localhost:5432/cparl</connection-url>

            <driver-class>org.postgresql.Driver</driver-class>

            <user-name>postgres</user-name>

            <password></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 (optional) -->

            <metadata>

            <type-mapping>PostgreSQL 8.0</type-mapping>

            </metadata>

            </local-tx-datasource>

            </datasources>

            • 3. Re: jboss 5.1.GA connection issue with postgresql 8.4
              peterj

              Data source configuration has not changed in any significant way between 4.0.x, 4.2.x and 5.x, so I doubt that it has anything to do with the *-ds.xml file. Please post the full log messages, includuing stack trace, for the exception, and post the code that is failing, highlighting the line that gets the exception. Also make sure that is is the first ecpetion that was thrown.