2 Replies Latest reply on May 23, 2002 3:23 PM by gifkins

    Help for setting up PostgreSQL JDBC pool

    gifkins

      I am using JBOSS 2.4.5 and try to set up JBDC pool for Postgresql.
      my PostgreSQL version is 7.2.1
      I tried both jdbc7.0-1.2.jar and pgjdbc2.jar as driver

      code i put in jboss.jcml are:


      org.postgresql.Driver



      shaneTestDS
      org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl


      jdbc:postgresql://192.168.255.198:5432/shane_test

      1200000
      postgres
      10

      false
      false
      false
      true
      120000
      1800000
      false
      false
      1.0
      0




      relevant code I put in standardjaws.xml are

      java:/shaneTestDS
      <type-mapping>PostgreSQL</type-mapping>
      false

      for some reason when I startup Jboss, it shows error like this:

      //**************Jboss server output********************
      [INFO,JdbcProvider] Starting
      [INFO,JdbcProvider] Started
      [INFO,shaneTestDS] Starting
      [INFO,XAPoolDataSource] Creating XA Pool
      [INFO,shaneTestDS] XA Connection pool shaneTestDS bound to java:/shaneTestDS
      [ERROR,XAConnectionFactory] Can't get an XAConnection
      java.sql.SQLException: No suitable driver
      at java.sql.DriverManager.getConnection(DriverManager.java:532)
      at java.sql.DriverManager.getConnection(DriverManager.java:171)
      at org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl.getXAConnection(XADat
      aSourceImpl.java:176)
      at org.jboss.pool.jdbc.xa.XAConnectionFactory.createObject(XAConnectionF
      actory.java:282)
      at org.jboss.pool.ObjectPool.createNewObject(ObjectPool.java:1004)
      at org.jboss.pool.ObjectPool.getObject(ObjectPool.java:663)
      at org.jboss.pool.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSourc
      e.java:215)
      at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.jav
      a:412)
      at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:103
      )
      at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:16
      28)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
      23)
      at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(Conf
      igurationService.java:967)
      at $Proxy0.start(Unknown Source)
      at org.jboss.util.ServiceControl.start(ServiceControl.java:79)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:16
      28)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
      23)
      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,shaneTestDS] Stopped
      java.lang.RuntimeException: Could not create connection
      at org.jboss.pool.ObjectPool.createNewObject(ObjectPool.java:1008)
      at org.jboss.pool.ObjectPool.getObject(ObjectPool.java:663)
      at org.jboss.pool.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSourc
      e.java:215)
      at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.jav
      a:412)
      at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:103
      )
      at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:16
      28)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
      23)
      at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(Conf
      igurationService.java:967)
      at $Proxy0.start(Unknown Source)
      at org.jboss.util.ServiceControl.start(ServiceControl.java:79)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:16
      28)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
      23)
      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.RuntimeException: Could not create connection
      at org.jboss.pool.ObjectPool.createNewObject(ObjectPool.java:1008)
      at org.jboss.pool.ObjectPool.getObject(ObjectPool.java:663)
      at org.jboss.pool.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSourc
      e.java:215)
      at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.jav
      a:412)
      at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:103
      )
      at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:16
      28)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
      23)
      at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(Conf
      igurationService.java:967)
      at $Proxy0.start(Unknown Source)
      at org.jboss.util.ServiceControl.start(ServiceControl.java:79)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:16
      28)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
      23)
      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)
      [INFO,HypersonicDatabase] Starting
      [INFO,STDERR] Server 1.6 is running
      //***************************************

      any idea about why this may happen? or are there anything else i didnt think about?
      Thank you.

      Shane(gifkins@hotmail.com)

        • 1. Re: Help for setting up PostgreSQL JDBC pool
          obergner

          I am by no stretch of the imagination an expert in this field, yet a few questions:

          1) You did copy the pgjdbc2.jar into jboss' lib/ or lib/ext directory, didn't you?

          2) I am not sure whether those drivers you mentioned do indeed support XA data sources, that is distributed transactions. The PostgreSQL JDBC Status Page under http://lab.applinet.nl/postgresql-jdbc/ isn't shure either. What's more, I strongly suspect that this is not what you want. Most often, you will only need local transactions. So you should configure a local data source loader. Unfortunately, I'm using JBoss 3.0 and thus unable to offer you precise instructions as to how to do so.

          Anyway, hope this helps.

          Good luck,

          Olaf

          • 2. Re: Help for setting up PostgreSQL JDBC pool
            gifkins

            Thank you for clue

            Yes I did copy the drivers into the right place lib/ext

            I have no idea about the distributed transaction, but the example i found works for other database, i just changed the driver to use PostgreSQL driver and the URL of the database, and many tutorials I read said this too. My database does locate on another machine.
            just dont know why its not working for me