in DevOps

org.jboss.msc.service.DuplicateServiceException: Service jboss.jdbc-driver.com_mysql is already registered


  • JBoss version 7.x
  • MySQL JDBCdriver
    • 5.1.30 and up


  • Using the CLI to register the mysql driver, we get an error.
  • Using the jar installer and adding the mysql driver during install, we get an error.
10:15:02,335 INFO  [] (ServerService Thread Pool -- 25) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
10:15:02,344 INFO  [] (ServerService Thread Pool -- 25) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1)
10:15:02,346 ERROR [] (ServerService Thread Pool -- 25) JBAS014612: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("jdbc-driver" => "mysql")
]): org.jboss.msc.service.DuplicateServiceException: Service jboss.jdbc-driver.mysql is already registered
        at org.jboss.msc.service.ServiceRegistrationImpl.setInstance( [jboss-msc.jar:1.0.4.GA-redhat-1]
  • We’re trying to create a new JDBC dataSource using cli command and we’re getting this error :
    "outcome" => "failed",
    "failure-description" => "JBAS014749: Manejador de operaciones fallido: Service jboss.jdbc-driver.XYZDriver is already registered",
    "rolled-back" => true


  • This is fixed in WFLY-3218 by only registering the first driver. Any second driver class needs to be specifically set.
  • For the current EAP 6.x versions, setting the driver class is accepted as the solution. There are no plans to backport.
  • When adding the driver using the CLI, one needs to specify the driver class name (prefix with the correct profile for domain mode)
  • Add this line to the “drivers” section in the subsystem “datasources” in standalone.xml.


    This results in the following xml snippet:

<subsystem xmlns="urn:jboss:domain:datasources:1.1">
       <driver name="mysql" module="com.mysql.jdbc">

Root Cause

  • The MySQL driver version 5.1.30 now has two driver classes registered in META-INF/services/java.sql.Driver

The JDBC 4 specifications in section “9.2.1 Loading a driver that implements java.sql.Driver” does not explicitly state that more then one entry is allowed or disallowed.