WildFly 31.0.0.Final standalone startup fails with MySQL driver not found (as module)

341 views
Skip to first unread message

Karsten Wu

unread,
Jan 29, 2024, 11:24:00 AM1/29/24
to WildFly
Hello all.

I could repeat the whole post here, don't know if I should, but I've posted my problem on SO with inline screenshots:


The task is simple: setup a fresh local WildFly to connect to a local MySQL instance, therefore install the latest MySQL JDBC connector as module and then hook the driver to the datasource and voila.

But it's not working:

```
09:49:31,266 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "BBStatsDS")
]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.mysql"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "service jboss.data-source.\"jboss.naming.context.java.jboss.datasources.BBStatsDS\" is missing [jboss.jdbc-driver.mysql]",
        "service jboss.driver-demander.java:jboss/datasources/BBStatsDS is missing [jboss.jdbc-driver.mysql]"
    ]
}
09:49:31,267 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "BBStatsDS")
]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => [
        "jboss.jdbc-driver.mysql",
        "jboss.jdbc-driver.mysql"
    ],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "service jboss.data-source.\"jboss.naming.context.java.jboss.datasources.BBStatsDS\" is missing [jboss.jdbc-driver.mysql]",
        "service jboss.driver-demander.java:jboss/datasources/BBStatsDS is missing [jboss.jdbc-driver.mysql]",
        "service jboss.data-source.\"jboss.naming.context.java.jboss.datasources.BBStatsDS\" is missing [jboss.jdbc-driver.mysql]"
    ]
}
09:49:31,272 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0184:    New missing/unsatisfied dependencies:
      service jboss.jdbc-driver.mysql (missing) dependents: [service jboss.driver-demander.java:jboss/datasources/BBStatsDS, service jboss.data-source."jboss.naming.context.java.jboss.datasources.BBStatsDS"]
WFLYCTL0448: 2 additional services are down due to their dependencies being missing or failed
```

What's wrong? I did this sooo many times.

Thanks
Karsten

Ebuzer Taha Kanat

unread,
Jan 29, 2024, 11:39:09 AM1/29/24
to WildFly
Can you add the pom.xml file here?

29 Ocak 2024 Pazartesi tarihinde saat 19:24:00 UTC+3 itibarıyla Karsten Wu şunları yazdı:

Ebuzer Taha Kanat

unread,
Jan 29, 2024, 11:50:53 AM1/29/24
to WildFly
Instead of adding mysql driver as a module try adding to your pom file.

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.33</version>
</dependency>

I also suggest defining datasource with @DataSourceDefinition annotation that way your code will be Application server agnostic and it is lot easier if you work with Docker. configuration as code.

@Singleton

@DataSourceDefinition(

name = "java:app/deneme2DS",

className = "org.h2.jdbcx.JdbcDataSource",

url = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1",

user = "sa",

password = "sa"

)

public class DataSourceConfig {

// This class can be empty, as it only serves to define the DataSource

// The DataSource will be automatically registered when this class is loaded

}


29 Ocak 2024 Pazartesi tarihinde saat 19:39:09 UTC+3 itibarıyla Ebuzer Taha Kanat şunları yazdı:

Ka Wu

unread,
Feb 1, 2024, 7:36:23 PM2/1/24
to WildFly
I really appreciate your reply. I believe your idea is even better than what I did for years.

I tried your setup (I also found your recent posting) and it works like a charm. Like this the driver is loaded via Maven and the DataSource is defined inside the app.

Thanks.
Reply all
Reply to author
Forward
0 new messages