Bug #72206 Wildfly 8.0 Server fails loading mysql connector
Submitted: 2 Apr 2014 10:05 Modified: 10 Apr 2014 12:40
Reporter: Juan Manuel Enrique Muñido Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.30 OS:Linux (Ubuntu 12.04, 64 bits)
Assigned to: Jess Balint CPU Architecture:Any
Tags: 5.1.30, connector, java, MySQL

[2 Apr 2014 10:05] Juan Manuel Enrique Muñido
Description:
Wildfly 8.0 server fails when it try to deploy a JavaEE web application, with hibernate JPA provider.

The wildfly output when it try to deploy the web application with the 5.1.30 versión of the connector/J is the following:

How to repeat:
Upgrade the connector/J version from any before 5.1.29 to 5.1.30. Wildfly 8.0 with Mysql connector/J 5.1.29 works fine, but when I upgrade to 5.1.30, it fails.
[2 Apr 2014 10:11] Juan Manuel Enrique Muñido
Wildfly 8.0 fails when deploying a Mysql Connector/J 5.1.30 with Hibernate 4.3.4 JPA web application.
[2 Apr 2014 10:13] Juan Manuel Enrique Muñido
Wildfly 8.0 fails when deploying a JavaEE web application with Mysql Connector/J 5.1.30 and Hibernate 4.3.4 JPA
[2 Apr 2014 23:04] Jess Balint
Please show your module.xml from modules/com/mysql/main (or where you have deployed it) and the driver and data source section from your configuration. Please check for typos in the filename of the driver.
[3 Apr 2014 0:28] Juan Manuel Enrique Muñido
<-- BEGIN of /opt/wildfly-8.0.0.Final/modules/system/layers/base/com/mysql/main/module.xml -->

<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2010, Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->

<module xmlns="urn:jboss:module:1.1" name="com.mysql">

    <resources>
        <resource-root path="mysql-connector-java-5.1.30-bin.jar"/>
        <!-- Insert resources here -->
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
        <module name="javax.servlet.api" optional="true"/>
    </dependencies>
</module>

<-- END of /opt/wildfly-8.0.0.Final/modules/system/layers/base/com/mysql/main/module.xml -->

<-- BEGIN of datasource section of /opt/wildfly-8.0.0.Final/standalone/configuration/standalone.xml -->

<subsystem xmlns="urn:jboss:domain:datasources:2.0">
            <datasources>
                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                    <driver>h2</driver>
                    <security>
                        <user-name>sa</user-name>
                        <password>sa</password>
                    </security>
                </datasource>
                <datasource jta="false" jndi-name="java:/TCAppMySQLDS" pool-name="TCAppMySQLDS" enabled="true" use-ccm="false">
                    <connection-url>jdbc:mysql://localhost:3306/tcapp</connection-url>
                    <driver-class>com.mysql.jdbc.Driver</driver-class>
                    <driver>mysqlDriver</driver>
                    <security>
                        <user-name>databaseuser</user-name>
                        <password>databasepassword</password>
                    </security>
                    <validation>
                        <validate-on-match>false</validate-on-match>
                        <background-validation>false</background-validation>
                    </validation>
                    <statement>
                        <share-prepared-statements>false</share-prepared-statements>
                    </statement>
                </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                    <driver name="mysqlDriver" module="com.mysql">
                        <xa-datasource-class>com.mysql.jdbc.Driver</xa-datasource-class>
                    </driver>
                </drivers>
            </datasources>
        </subsystem>

<-- END of datasource section of /opt/wildfly-8.0.0.Final/standalone/configuration/standalone.xml -->
[3 Apr 2014 2:57] Jess Balint
Can you try adding the driver class name to the driver definition?

<drivers>
  <driver name="mysqlDriver" module="com.mysql">
    <xa-datasource-class>com.mysql.jdbc.Driver</xa-datasource-class>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
  </driver>
</drivers>
[3 Apr 2014 20:51] Juan Manuel Enrique Muñido
Now it works!

Adding the following lines:

<driver-class>
    com.mysql.jdbc.Driver
</driver-class>

as you suggested, makes Wildfly 8.0 load the MySQL Connector/J successfully. However, before 5.1.30 version of the MySQL Connector/J, Wildfly 8.0 was able to load the connector without these lines.

Many thanks.
[9 Apr 2014 8:05] Alexander Soklakov
I mark this as Verified, because behavior reported was caused by recent changes in Connector/J, however, it's rather a bug in application server.

I also change the severity level to S3 because there is a workaround.
[10 Apr 2014 12:40] Jess Balint
Fixed in WildFly https://issues.jboss.org/browse/WFLY-3218