6 Replies Latest reply on May 19, 2002 6:56 PM by mseries

    jboss 2.4.4 connection to postgres

    mikew

      Hi All,

      I am trying to connect the JBoss2.4.4 server running on my machine to a postgreSQL(7.1.3) database running on another network machine. I understand that I have to configure various MBeans via the "jboss.jcml" file. So far I have done/modified the following in jboss.jcml......


      org.postgresql.Driver



      org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
      PostgresDS
      jdbc:postgresql://bimbo/object
      object
      assetdb


      From time spent searching this groups archives, I thought that this would be enough.....however, when I run the server, it generates the following......

      [INFO,PostgresDS] XA Connection pool PostgresDS bound to java:/PostgresDS
      [ERROR,PostgresDS] Stopped
      java.lang.NullPointerException
      at org.jboss.pool.jdbc.xa.XAPoolDataSource.getConnection(Unknown Source)
      at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:412)
      at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:103)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(ConfigurationService.java:967)
      at $Proxy0.start(Unknown Source)
      at org.jboss.util.ServiceControl.start(ServiceControl.java:79)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.Main.(Main.java:208)
      at org.jboss.Main$1.run(Main.java:110)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.jboss.Main.main(Main.java:106)
      [ERROR,ConfigurationService] Unexpected error
      java.lang.NullPointerException
      at org.jboss.pool.jdbc.xa.XAPoolDataSource.getConnection(Unknown Source)
      at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:412)
      at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:103)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(ConfigurationService.java:967)
      at $Proxy0.start(Unknown Source)
      at org.jboss.util.ServiceControl.start(ServiceControl.java:79)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.Main.(Main.java:208)
      at org.jboss.Main$1.run(Main.java:110)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.jboss.Main.main(Main.java:106)


      I have the correct jdbc driver in jboss/lib/ext for Postgres v7.1.3. I think the problem lies in jboss.jcml (not in the postgres database) because I can actually (as user 'object')connect to the database from the same machine (using Putty/Telnet) that the jboss server runs on and manipulate tables using 'psql'

      Any ideas?

      Thanks in advance,

      Mike

        • 1. Re: jboss 2.4.4 connection to postgres
          jwkaltz

          This connection pool mechanism tries to open a connection on server startup (I suppose this is to see whether the configuration is OK). If the JDBC getConnection() is not successful, this is not handled cleanly by JBoss and a NullPointerException occurs.

          My suggestion: run a stand-alone Java program which opens the connection with your parameters - this may give you more insight (and it's easier to try out different JDBC settings like that) :

          try {
          Class.forName("org.postgresql.Driver");
          Connection db = DriverManager.getConnection("jdbc:postgresql://:/" ,,);
          ...

          Once you have that working, you can use the exact same settings in your jboss.jcml

          • 2. Re: jboss 2.4.4 connection to postgres
            mikew

            We were thinking....maybe this has something to do with the OS I am using here (Windows NT 4.0). In that case, do I need to create a JDBC-ODBC bridge (using the ODBC data source administrator you can navigate to via "Control Panel"???

            Thanks

            Mike

            • 3. Re: jboss 2.4.4 connection to postgres
              mikew

              We were thinking....maybe this has something to do with the OS I am using here (Windows NT 4.0). In that case, do I need to create a JDBC-ODBC bridge (using the ODBC data source administrator you can navigate to via "Control Panel"???

              Thanks

              Mike

              • 4. Re: jboss 2.4.4 connection to postgres
                davidjencks

                1. Please move this discussion to the database-persistence forum.

                2. Follow the suggestion, and also don't use jdbc-odbc ever.

                • 5. Re: jboss 2.4.4 connection to postgres
                  mikew

                  The problem was with the database. It was not running with the "-i" flag to accept TCP/IP connections.

                  Thanks

                  • 6. Re: jboss 2.4.4 connection to postgres
                    mseries

                    Does this configuration allow CMP beans to use your Postgres database ? What would I need to do to allow a stateless session bean query a Postgres database. If possible can you detail the configuration AND the java to get the Connection.
                    Thanks