Bug 1107120 - Failures when deploying MySQL JDBC driver to EAP 6.x
Summary: Failures when deploying MySQL JDBC driver to EAP 6.x
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: JCA
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: DR1
: EAP 6.4.0
Assignee: tom.jenkinson
QA Contact: Martin Simka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-09 19:41 UTC by Josef Cacek
Modified: 2019-08-19 12:41 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1097166 0 unspecified CLOSED Cannot deploy the latest MySQL driver into EAP 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1107130 0 unspecified CLOSED Additional JDBC drivers should not be in system/layers/base 2021-02-22 00:41:40 UTC
Red Hat Issue Tracker WFLY-3218 0 Major Closed Module for MySQL JDBC driver with version 5.1.30+ needs <driver-class> in standalone.xml 2019-06-12 09:55:44 UTC

Internal Links: 1097166 1107130

Description Josef Cacek 2014-06-09 19:41:39 UTC
When 2 or more classes are used in META-INF/services/java.sql.Driver, then adding the JDBC driver fails with message:
JBAS014749: Operation handler failed: Service jboss.jdbc-driver.mysql is already registered

Steps to reproduce - Follow instructions "6.2.2. Install a JDBC Driver as a Core Module" in Admin guide [1]:

1) download MySQL JDBC driver from [2], put it under [EAP_INST]/modules/com/mysql/main/ and create also module.xml

2) run ./standalone.sh

3) run CLI command:
/subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-xa-datasource-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource)

It results in response:
{     
    "outcome" => "failed",
    "failure-description" => "JBAS014749: Operation handler failed: Service jboss.jdbc-driver.mysql is already registered",
    "rolled-back" => true
}

And server-log contains exception [3].

4.a) when the user realizes there are 2 driver classes, he can try to fix the problem with specifying the driver class:
/subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-xa-datasource-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource, driver-class-name=com.mysql.jdbc.Driver)

but:
{
    "outcome" => "failed",
    "failure-description" => "JBAS010434: Unable to instantiate driver class \"com.mysql.jdbc.Driver\". See log (WARN) for more details",
    "rolled-back" => true
}

4.b) so the user tries to delete existing instance:
/subsystem=datasources/jdbc-driver=mysql:remove

but:
{     
    "outcome" => "failed",
    "failure-description" => "JBAS014807: Management resource '[
    (\"subsystem\" => \"datasources\"),
    (\"jdbc-driver\" => \"mysql\")
]' not found",
    "rolled-back" => true
}

5) when user reload (or restart) server, he's able to add the driver:
[standalone@localhost:9999 /] reload
[standalone@localhost:9999 /] /subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-xa-datasource-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource, driver-class-name=com.mysql.jdbc.Driver)
{"outcome" => "success"}


Points 3, 4.a and 4.b shows issues when adding the JDBC driver.

[1] https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6.2/html/Administration_and_Configuration_Guide/Install_a_JDBC_Driver_as_a_Core_Module1.html
[2] http://dev.mysql.com/downloads/connector/j/

[3]
21:24:20,463 INFO  [org.jboss.as.connector.subsystems.datasources] (management-handler-thread - 3) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
21:24:20,475 INFO  [org.jboss.as.connector.subsystems.datasources] (management-handler-thread - 3) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1)
21:24:20,486 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 3) 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(ServiceRegistrationImpl.java:158) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
	at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:236) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
	at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:742) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
	at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:243) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
	at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2433) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
	at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:345) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
	at org.jboss.as.controller.OperationContextImpl$ContextServiceBuilder.install(OperationContextImpl.java:1672) [jboss-as-controller-7.4.0.Final-redhat-15.jar:7.4.0.Final-redhat-15]
	at org.jboss.as.connector.subsystems.datasources.JdbcDriverAdd.startDriverServices(JdbcDriverAdd.java:160)
	at org.jboss.as.connector.subsystems.datasources.JdbcDriverAdd.performRuntime(JdbcDriverAdd.java:118)
...

Comment 1 Josef Cacek 2014-06-10 09:53:22 UTC
The problem can be reproduced with MySQL driver version 5.1.30 and newer. Older versions have only 1 entry in the META-INF/services/java.sql.Driver file.

Comment 2 Stefano Maestri 2014-09-10 14:42:11 UTC
Need a backport of jira issue

Comment 3 Kabir Khan 2014-09-15 11:20:58 UTC
https://github.com/jbossas/jboss-eap/pull/1674

Comment 4 Jeff Zhang 2014-09-16 10:18:42 UTC
PR https://github.com/jbossas/jboss-eap/pull/1674 for 6.X had been merged.
PR for 6.3.X is https://github.com/jbossas/jboss-eap/pull/1688

Comment 5 Martin Simka 2014-09-18 12:06:04 UTC
verified on EAP 6.4.0.DR1.1


Note You need to log in before you can comment on or make changes to this bug.