Passa ai contenuti principali

Install Mysql JDBC Driver on WildFly 8.2

The tutorial explains how to install a jdbc driver on RedHat WildFly application server a module, in the sample will be used the mysql driver but the proposed steps can be applied to any other driver library

Used technologies in the tutorial:

  • Wild Fly 8.2.0.Final
  • Mysql Connector 5.1.33

1. Create the jboss module

Enter in the file path ${EAP_HOME}/modules/system/layers/base and create the directories com/mysql/driver/main.

Into the folder main copy the driver library jar (link) and create a file module.xml as showed in the sample below

<module xmlns="urn:jboss:module:1.3" name="com.mysql.driver">
  <resource-root path="mysql-connector-java-5.1.33.jar" />
  <module name="javax.api"/>
  <module name="javax.transaction.api"/>

For an explanation about the meaning of the fields take a look at Jboss Module Documentation Page

2. Register the module as driver with CLI.

Start the server from the directory ${EAP_HOME}/bin:

./ --server-config=${server-profile}

Start the management CLI:


Run the the command:


If the operation is successful then the message below will be showed {"outcome" => "success"}

and into the file of the standalone profile the code below is produced

<driver name="mysql" module="com.mysql.driver">


  1. Risposte
    1. Questo commento è stato eliminato da un amministratore del blog.

  2. Very good, excellent. I am brasilian.

  3. Very good, excellent. I am swedish.

  4. Very good, excellent. I am greek.

  5. Thank You!! Helps a lot! Java EE Casa do Codigo =(!!!

  6. Questo commento è stato eliminato da un amministratore del blog.

  7. [disconnected /] connect
    [standalone@localhost:9990 /] /subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-class-name=com.mysql.jdbc.Driver)
    "outcome" => "failed",
    "failure-description" => "JBAS010441: Failed to load module for driver [com.mysql]",
    "rolled-back" => true
    [standalone@localhost:9990 /]


Posta un commento

Post popolari in questo blog

Running Java Applications as a Windows Service with NSSM

Sometimes there is the request to run a Java Application as a windows service, for this scenario it is possible to use a java wrapper as NSSM. The example uses a java application that log on file the boot operation, the alive status every 10 seconds, and the exit operation. The code of the example can be downloaded with SVN from the repository Java package org.gma.tutorial.nssm; import; import; import; import; import java.util.Date; /** * A Simple service to register as Windows Service, the program will log on a * file when it starts, ends and every 10 seconds it will log is alive state * * */ public class WindowsServiceTutorial { public static void main(String[] args) throws FileNotFoundException { /* Set the custom message to display */ String customMessage = "default"; if (args.leng…

org.w3c.dom.Document convertion Utils

How to convert an InputStream to a Document?
How to contert a Document to an InputStream? The snippet of code posted is an utility Java Class written in Java for org.w3c.dom.Document convertions, it supports:

Document to StringString to DocumentDocument to InputStreamInputStream to Document
package org.gma.util; import; import; import; import; import; import; import; import; import; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.xml.serialize.OutputFormat; import org.apache.xml.serialize.XMLSerializer; import org.w3c.dom.Document; import org.xml.sax.SAXException; public class DocumentUtils { /** * Convert a document to an Inputstream * @param document the document to convert * @param prettyPrint prettyPri…