JDBC driver cannot be cast to javax.sql.DataSource or javax.sql.XADataSource in JBoss EAP

Solution Verified - Updated -

Issue

  • Encountering a cast error using OracleDriver

    ... IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: IJ031084: Unable to create connection
            ...
    Caused by: javax.resource.ResourceException: IJ031089: Failed to load datasource: oracle.jdbc.driver.OracleDriver
            ...
    Caused by: java.lang.ClassCastException: oracle.jdbc.driver.OracleDriver cannot be cast to javax.sql.DataSource
            ...
    
  • Encountering a cast error using DB2Driver

    ... IJ000453: Unable to get managed connection for java:java/myds
        ...
    Caused by: javax.resource.ResourceException: IJ000658: Unexpected throwable while trying to create a connection: null
        ...
    Caused by: javax.resource.ResourceException: Could not create connection
        ...
    Caused by: java.lang.ClassCastException: com.ibm.db2.jcc.DB2Driver cannot be cast to javax.sql.XADataSource
        ... 
    

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6
    • 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content