As shown in the title of this article which is happened to show the actual error message generated upon executing Wildfly Java Application server, specifically : “WFLYJCA0041: Failed to load module for driver [com.mysql]”. The content of the actual error retrieved from a file named server.log located in the Wildfly Java Application Server specified as follows :
21:51:07,332 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 36) WFLYCTL0013: Operation ("add") failed - address: ([ ("subsystem" => "datasources"), ("jdbc-driver" => "mysql") ]) - failure description: "WFLYJCA0041: Failed to load module for driver [com.mysql]"
The server.log file itself is located in the Wildfly Java Application Server’s main path installation. In the context of the article, it is located in ‘/opt/wildfly-12.0.0.Final’ while the log file named server.log which is used as the log file for further reference in error checking is located in ‘/opt/wildlfy-12.0.0.Final/standalone’ folder. It is because there is no domain used, just a standalone mode for running Wildfly Java Application Server.
user@hostname:/opt/wildfly-12.0.0.Final$ tree -L 3 . ├── appclient │ └── configuration │ ├── appclient.xml │ └── logging.properties ├── bin ... │ ├── appclient.sh │ ├── client │ │ ├── jboss-cli-client.jar │ │ ├── jboss-client.jar │ │ ├── README-CLI-JCONSOLE.txt │ │ └── README-EJB-JMS.txt ... │ └── wsprovide.sh ├── copyright.txt ├── docs │ ├── contrib │ │ └── scripts │ ├── examples │ │ ├── configs │ │ └── enable-elytron.cli │ ├── licenses ... │ │ └── the jsoup mit license.html │ └── schema │ ├── application_1_4.xsd │ ├── application_5.xsd │ ├── application_6.xsd │ ├── application_7.xsd ........... ├── domain │ ├── configuration │ │ ├── application-roles.properties │ │ ├── application-users.properties │ │ ├── default-server-logging.properties │ │ ├── domain.xml │ │ ├── host-master.xml │ │ ├── host-slave.xml │ │ ├── host.xml │ │ ├── logging.properties │ │ ├── mgmt-groups.properties │ │ └── mgmt-users.properties │ ├── data │ │ └── content │ └── tmp │ └── auth ├── jboss-modules.jar ├── LICENSE.txt ├── modules │ ├── com │ │ └── mysql │ └── system │ └── layers ├── nohup.out ├── README.txt ├── standalone │ ├── configuration ... │ │ └── standalone_xml_history │ ├── data │ │ ├── activemq │ │ ├── content │ │ ├── kernel │ │ ├── timer-service-data │ │ └── tx-object-store │ ├── deployments ... │ │ ├── webapp.war │ │ └── webapp.war.deployed │ ├── lib │ │ └── ext │ ├── log │ │ ├── audit.log │ │ ├── server.log ... │ │ └── server.log.2018-06-17 │ └── tmp │ ├── auth │ ├── startup-marker │ ├── webapp-1.0-SNAPSHOT.war │ ├── vfs │ └── webapp.war ... └── wildfly_logo.png 43 directories, 472 files user@hostname:/opt/wildfly-12.0.0.Final$
Focusing on the error message which is ‘Failed to load module for driver [com.mysql]’, it is happened because the driver defined as ‘com.mysql’ cannot be loaded. The definition of the driver itself is located in a file named standalone.xml which in the context of this article, it is located in ‘/opt/wildfly-12.0.0.Final/standalone/configuration’. Below is the content of the file which is defining the ‘com.mysql’ driver :
<driver name="mysql" module="com.mysql"> <driver-class>com.mysql.cj.jdbc.Driver</driver-class> </driver>
The above definition of the ‘com.mysql’ driver itself needs another step to be taken further so the driver is properly loaded. Just make sure that all of the steps taken in this article titled ‘How to Load MySQL Database Driver in Wildfly Java Application Server’ in this link to load and define ‘com.mysql’ driver has been carried out successfully. The most important thing is the module attribute must contain the same value with the name of the driver specified in the file named module.xml where the definition of the MySQL Database Driver defined. In this context, it is ‘com.mysql’.
One thought on “How to Solve Wildfy Error Message : WFLYJCA0041: Failed to load module for driver [com.mysql]”