I have a Java Web application that uses the OracleConnection JDBC class to execute some PL/SQL commands. As in our production environment the Oracle driver library is shared by other applications, I need to declare it with a provided Maven dependency scope:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>oracle</artifactId>
<version>11.2.0.4</version>
<scope>provided</scope>
</dependency>
How should I configure my local JBoss EAP 6.2 to make this library available for my application? I have tryed to configure it as a core module using jboss-cli as described in
Install a JDBC Driver as a Core Module
This was the last command I have executed:
/subsystem=datasources/jdbc-driver=oracle:
add(driver-name=oracle,
driver-module-name=oracle.jdbc,
driver-xa-datasource-class-name=oracle.jdbc.xa.client.OracleXADataSource)
Commnad output:
{"outcome" => "success"}
However, at startup our application try to get a connection via DriverManager:
OracleConnection conn = (OracleConnection) DriverManager.getConnection(url, username, password);
This line of code is raising the following exception:
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@10.50.240.70:1521:doc21a
By other hand, if I change the scope to compile, then the Oracle library is deployed along with my application (inside META-INF/lib folder) and everything works fine.
How can I fix this issue? Are core modules proper for this?
Is there another way of sharing libraries with multiple applications using JBoss?