1 Reply Latest reply on Dec 30, 2011 3:29 AM by akpramod

    AS7: Wrong Driver Class for Postgresql

    akpramod

      Dear JBoss users,

       

      I am facing an issue with creating the postgresql connection pool with postgres 9.1 + AS7.

      I deployed the postgres jdbc driver in the deployments folder and then when the standalone server is started, I see the following exceptions.

      The postgres database is up and running.

       

      =====

      08:29:03,281 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) added javax.persistence.api dependency to postgresql-9.1-901.jdbc4.jar

       

      08:29:03,312 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.1)

      08:29:03,328 INFO  [org.jboss.as.server.controller] (Controller Boot Thread) Deployed "postgresql-9.1-901.jdbc4.jar"

      08:29:03,515 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) Bound data source [java:jboss/datasources/myDS]

       

      08:29:03,546 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (JCA PoolFiller) IJ000610: Unable to fill pool: javax.resource.ResourceException: Could not create connection

          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:277)

          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:235)

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:706) [ironjacamar-core-impl-1.0.3.Final.jar:1.0.3.Final]

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.fillToMin(SemaphoreArrayListManagedConnectionPool.java:653) [ironjacamar-core-impl-1.0.3.Final.jar:1.0.3.Final]

          at org.jboss.jca.core.connectionmanager.pool.mcp.PoolFiller.run(PoolFiller.java:97) [ironjacamar-core-impl-1.0.3.Final.jar:1.0.3.Final]

          at java.lang.Thread.run(Thread.java:662) [:1.6.0_30]

       

      Caused by: javax.resource.ResourceException: Wrong driver class [class org.postgresql.Driver] for this connection URL [jdbc:postgres://localhost:5432/mydb]

          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:251)

       

          ... 5 more

       

      08:29:03,578 INFO  [org.jboss.as] (Controller Boot Thread) JBoss AS 7.0.2.Final "Arc" started in 8782ms - Started 108 of 165 services (57 services are passive or on-demand)

      =====

       

      My datasource configuration in standalone.xml is as below.

       

      =====

      <datasources>

          <datasource jndi-name="java:jboss/datasources/myDS" pool-name="myDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">

              <connection-url> jdbc:postgres://localhost:5432/mydb </connection-url>

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

                     <driver> postgresql-9.1-901.jdbc4.jar </driver>

                     <pool>

                  <min-pool-size> 10 </min-pool-size>

                         <max-pool-size> 100 </max-pool-size>

                         <prefill> true </prefill>

                         <use-strict-min> false </use-strict-min>

                         <flush-strategy> FailingConnectionOnly </flush-strategy>

                     </pool>

                     <security>

                         <user-name> admin </user-name>

                         <password> abc123 </password>

                     </security>

                     <statement>

                         <prepared-statement-cache-size> 32 </prepared-statement-cache-size>

                         <share-prepared-statements/>

                     </statement>

                 </datasource>

                 <drivers>

                     <driver name="postgresql-9.1-901.jdbc4.jar" module="org.postgresql">

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

                         <xa-datasource-class> org.postgresql.xa.PGXADataSource </xa-datasource-class>

                     </driver>

                 </drivers>

      </datasources>

      =====

       

      Thanks.