1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[JBoss] WildFly 35: Missing jboss.jdbc-driver.com_mysql while configuring MySQL DataSource

Discussão em 'StackOverflow' iniciado por Stack, Janeiro 16, 2025.

  1. Stack

    Stack Membro Participativo

    I’m trying to configure a MySQL DataSource in WildFly 35 and encountering the following errors during server startup:

    ("subsystem" => "datasources"),
    ("data-source" => "MySQLDS")
    ]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.com_mysql"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
    "service jboss.data-source.\"jboss.naming.context.java.jboss.datasources.MySQLDS\" is missing [jboss.jdbc-driver.com_mysql]",
    "service jboss.driver-demander.java:jboss/datasources/MySQLDS is missing [jboss.jdbc-driver.com_mysql]"
    ]
    }


    My Configuration

    1. standalone.xml:

    <datasources>
    <datasource jndi-name="java:jboss/datasources/MySQLDS" pool-name="MySQLDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
    <connection-url>jdbc:mysql://localhost:3306/examdb?useUnicode=true&amp;characterEncoding=UTF-8&amp;useSSL=false</connection-url>
    <driver>com.mysql</driver>
    <security user-name="root" password="pwd"/>
    </datasource>
    <drivers>
    <driver name="mysql" module="com.mysql">
    <driver-class>com.mysql.cj.jdbc.Driver</driver-class>
    </driver>
    </drivers>
    </datasources>
    </subsystem>

    1. module.xml:

    <module xmlns="urn:jboss:module:1.1" name="com.mysql">
    <resources>
    <resource-root path="mysql-connector-j-8.0.33.jar"/>
    </resources>
    <dependencies>
    <module name="jakarta.api"/>
    <module name="javax.transaction.api"/>
    </dependencies>
    </module>


    The MySQL Connector JAR (mysql-connector-j-8.0.33.jar) is placed in the directory:

    {WILDFLY_HOME}/modules/system/layers/base/com/mysql/main/

    Screenshot of Admin Console:


    Admin Console

    Questions

    What could be causing WildFly to not recognize the MySQL driver module? Is there an additional configuration step I’m missing for WildFly 35 compatibility? How can I resolve this issue and successfully configure the MySQL DataSource? Any help or suggestions are greatly appreciated!

    I'm using WildFly 35, which supports Jakarta EE 9/10. The application's dependencies rely on Jakarta packages instead of javax. I suspect that this might influence how the MySQL driver is registered, but I’m not sure if WildFly treats JDBC driver modules differently in Jakarta EE projects. Driver Registration:

    Based on the error message (jboss.jdbc-driver.com_mysql is missing), it seems WildFly isn’t loading the MySQL driver module. My assumption is that the configuration in standalone.xml should link the module and provide the necessary driver class for the datasource, but the error indicates otherwise. Troubleshooting Steps I’ve Tried:

    Verified that mysql-connector-j-8.0.33.jar exists at {WILDFLY_HOME}/modules/system/layers/base/com/mysql/main/ and matches the path in module.xml.

    Restarted WildFly after every configuration change. Double-checked the module.xml syntax and dependencies. Observations from Admin Console:

    In the WildFly Admin Console under Configuration -> Subsystems -> Datasources, the MySQL datasource appears but is marked as invalid due to the missing driver (jboss.jdbc-driver.com_mysql).

    Continue reading...

Compartilhe esta Página