-----
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.9">
<resources>
<resource-root path="mysql-connector-j-9.4.0.jar"/>
</resources>
<dependencies>
<module name="jakarta.api"/>
<module name="jakarta.transaction.api"/>
<module name="jakarta.xml.bind.api"/>
</dependencies>
</module>
------
is placed in /Installation Folder/wildfly/modules/system/layers/base/com/mysql/main/
directory together with mysql-connector-j-9.4.0.jar
When added using the management console, it produces:
WFLYJCA0041: Failed to load module for driver [com.mysql]
WFLYJCA0115: Module for driver [com.mysql] or one of its dependencies is missing: [jakarta.api]
As a workaround, I inserted the following code in the standalone.xml configuration file, which fixed the problem.
<driver name="mysql" module="com.mysql">
<driver-class>com.mysql.cj.jdbc.Driver</driver-class>
<xa-datasource-class>com.mysql.cj.jdbc.MysqlXADataSource</xa-datasource-class>
</driver>
This tells me that the management console has a bug and is unable to add the JDBC driver as a module.