Exception java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL when trying to use an non-XA Oracle datasource

Solution Verified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7.2
  • Oracle (non-XA datasource)

Issue

  • The following exception is raised when obtaining a connection from a non-XA Oracle datasource after the datasource was created using the JBoss EAP web console:

    ... Caused by: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
        at oracle.jdbc.pool.OracleDataSource.makeURL(OracleDataSource.java:1277)
        at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:185)
    

Resolution

If creating the datasource using the web console and if the datasource-class was not intentionally specified, see Web console automatically sets datasource-class attribute for non-XA datasource in JBoss EAP 7.2 for the recommended workaround.

The web console error1 is resolved in EAP 7.2 cumulative patch (CP) 2 and later. However, even after patch application, datasources created prior to application of the cumulative patch will require manual correction (if not already performed):

  • The datasource-class attribute line should be removed manually from the standalone*.xml or domain.xml

Note that datasources created using the CLI interface will not exhibit this issue.

Root Cause

  • The web console automatically adds a datasource-class attribute in JBoss EAP 7.2 and this may be incompatible with the normal configuration (connection-url cannot be used with a datasource class and a connection-property named "URL" must be used, instead) when using a non-XA datasource pool.

    <datasource-class>oracle.jdbc.pool.OracleDataSource</datasource-class>
    

Diagnostic Steps

Search for java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL on the server.log

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments