Skip to content

Instantly share code, notes, and snippets.

@jmesnil
Last active April 2, 2024 12:43
Show Gist options
  • Save jmesnil/60384821d3c869a813c51c03ccb0cead to your computer and use it in GitHub Desktop.
Save jmesnil/60384821d3c869a813c51c03ccb0cead to your computer and use it in GitHub Desktop.
WildFly with Oracle JDBC driver
$ ls .
Dockerfile      module.xml      ojdbc11.jar

$ cat module.xml

<module xmlns="urn:jboss:module:1.9" name="com.oracle">
    <resources>
      <resource-root path="ojdbc11.jar"/>
    </resources>
    <dependencies>
      <module name="javax.api"/>
      <module name="javax.transaction.api"/>
    </dependencies>
  </module>

$ cat Dockerfile

FROM quay.io/wildfly/wildfly:28.0.1.Final-jdk17

COPY module.xml $JBOSS_HOME/modules/com/oracle/main/
COPY ojdbc11.jar $JBOSS_HOME/modules/com/oracle/main/

$ docker build -t wildfly-with-oracle .
$ docker run -p 8080:8080 wildfly-with-oracle:latest

For the next command, replace d437c231ccf9 with your own container ID (from docker ps)

$ docker exec -it d437c231ccf9 /opt/jboss/wildfly/bin/jboss-cli.sh -c

[standalone@localhost:9990 /] /subsystem=datasources/jdbc-driver=oracle:add(driver-module-name=com.oracle)
{"outcome" => "success"}

In the logs from WildFly, you will see:

09:29:57,135 INFO  [org.jboss.as.connector.subsystems.datasources] (management-handler-thread - 1) WFLYJCA0004: Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 23.3)
09:29:57,135 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0018: Started Driver service with driver-name = oracle

=> that shows tha the oracle driver was properly created from the com.oracle JBoss Module

@jreed-cartago
Copy link

Once again I want to thank you for your assistance. Today it finally dawned on me what I did wrong. I made a typo in the module.xml which was so small it was easy to miss.

module xmlns="urn:joss:module:1.9" name="com.oracle"

Basically in the namespace I forgot the b in jboss. I can't believe that this was my problem. It works now and I'm getting the Success when I perform the manual adding of the oracle module.

@jmesnil
Copy link
Author

jmesnil commented Apr 2, 2024

@jreed-cartago Great that it works now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment