Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-25950

[GSS](7.4.z) Misleading error message - IJ031083: Wrong driver class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • None
    • JCA
    • None
    • False
    • None
    • False

      Using Enterprise DB edb-jdbc-42.2.12.1.jar , the driver is com.edb.Driver which is in META-INF/services/java.sql.Driver.

      Bundle-Description: Java JDBC 4.2 (JRE 8+) driver for EnterpriseDB database
      Implementation-Title: EnterpriseDB JDBC Driver - JDBC 4.2

      This configuration:

                      <datasource jndi-name="java:jboss/PostgresDS" pool-name="PostgresDS">
                          <connection-url>jdbc:postgresql://localhost:5432/postgresdb</connection-url>
                          <driver>postgresql</driver>
                          <security>
                              <user-name>admin</user-name>
                              <password>admin</password>
                          </security>
                          <validation>
                              <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
                              <validate-on-match>true</validate-on-match>
                              <background-validation>false</background-validation>
                              <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
                          </validation>
                      </datasource>
                      <drivers>
                          <driver name="h2" module="com.h2database.h2">
                              <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                          </driver>
                          <driver name="postgresql" module="com.postgresql">
                              <xa-datasource-class>com.edb.xa.PGXADataSource</xa-datasource-class>
                          </driver>
                      </drivers>

      Throws this error below:

      Throws this error below:

      Caused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/PostgresDS
         at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:690)
         at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:440)
         at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:789)
         at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:152)
         ... 58 more
      Caused by: javax.resource.ResourceException: IJ031084: Unable to create connection
         at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:364)
         at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:371)
         at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:287)
         at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.createConnectionEventListener(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1328)
         at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.getConnection(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:505)
         at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getTransactionNewConnection(AbstractPool.java:770)
         at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:666)
         at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:624)
         ... 61 more
      Caused by: javax.resource.ResourceException: IJ031083: Wrong driver class [com.edb.Driver] for this connection URL [jdbc:postgresql://localhost:5432/postgresdb]
         at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:337)
         ... 68 more

      You can also specify <driver-class>com.edb.Driver</driver-class> and get the same error.

      The error is misleading because it is saying the driver class com.edb.Driver is wrong, but the actual issue is a <datasource> is being defined but the driver only has <xa-datasource-class> , so it is wanting the <datasource-class> to be specified such as this:

                          <driver name="enterprisedb" module="com.edb">
                              <datasource-class>com.edb.ds.PGSimpleDataSource</datasource-class>
                              <xa-datasource-class>com.edb.xa.PGXADataSource</xa-datasource-class>
                          </driver>

      com.edb.xa.PGXADataSource implements XADataSource but not DataSource.  Some other jdbc datasources implement both such as 

      org.h2.jdbcx.JdbcDataSource implements XADataSource, DataSource ...

      Since H2 does not complain, it is probably IronJacamar using the xa-datasource-class and casting to DataSource , though we would have to check the code.

                      <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
                          <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                          <driver>h2</driver>
                          <security>
                              <user-name>sa</user-name>
                              <password>sa</password>
                          </security>
                      </datasource>
                      <drivers>
                          <driver name="h2" module="com.h2database.h2">
                              <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                          </driver>
                      </drivers>

      For this error, it should say something more like com.edb.xa.PGXADataSource does not implement javax.sql.DataSource

              chaowan@redhat.com Chao Wang
              rhn-support-bmaxwell Brad Maxwell
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: