"WFLYCTL0412: 未安装的必需服务:" => ["jboss.jdbc-driver.mysql"]

Posted

技术标签:

【中文标题】"WFLYCTL0412: 未安装的必需服务:" => ["jboss.jdbc-driver.mysql"]【英文标题】:"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.mysql"] 【发布时间】:2019-06-01 17:15:06 【问题描述】:

我正在尝试将 mysql 数据源添加到我的 wildfly(Jboss15.0.0) 服务器。 但是我遇到以下错误:

WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "MySqlDS")
]) - failure description: 
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.mysql"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "org.wildfly.data-source.MySqlDS is missing [jboss.jdbc-driver.mysql]",
        "jboss.driver-demander.java:/MySqlDS is missing [jboss.jdbc-driver.mysql]"
    ]

09:22:10,385 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "MySqlDS")
]) - failure description: 
    "WFLYCTL0412: Required services that are not installed:" => [
        "jboss.jdbc-driver.mysql",
        "jboss.jdbc-driver.mysql"
    ],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "org.wildfly.data-source.MySqlDS is missing [jboss.jdbc-driver.mysql]",
        "jboss.driver-demander.java:/MySqlDS is missing [jboss.jdbc-driver.mysql]",
        "org.wildfly.data-source.MySqlDS is missing [jboss.jdbc-driver.mysql]"
    ]

这是我的 module.xml:

<module xmlns="urn:jboss:module:1.0" name="mysql">
    <resources>
        <resource-root path="mysql-connector-java-5.1.46-bin.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>

这是我设置数据源的代码:

    <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="true" jndi-name="java:/MySqlDS" pool-name="MySqlDS" use-java-context="true" use-ccm="true">
                        <connection-url>jdbc:mysql://localhost:3306/onlinestock?characterEncoding=UTF8&amp;useSSL=false&amp;serverTimezone=GMT%2B8&amp;allowPublicKeyRetrieval=true</connection-url>
                        <driver>mysql</driver>
                        <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                        <pool>
                            <prefill>true</prefill>
                            <use-strict-min>false</use-strict-min>
                            <flush-strategy>FailingConnectionOnly</flush-strategy>
                        </pool>
                        <security>
                            <user-name>root</user-name>
                            <password>root</password>
                        </security>
                    </datasource>
                    <drivers>
                        <driver name="h2" module="com.h2database.h2">
                            <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                        </driver>
                        <driver name="mysql" module="com.mysql">
                            <xa-datasource-class>com.mysql.jdbc.Driver</xa-datasource-class>
                        </driver>
                    </drivers>
</datasources>

为什么服务器看不到我的mysql-connector。 module.xml 在 JBOSS_HOME/..../modules/..../mysql/main 目录下

【问题讨论】:

我已经在 [link]synaptiklabs.com/posts/…的帮助下解决了这个问题 【参考方案1】:

您的服务器无法找到我的 sql jar 请确认您也必须将我的 sql jar 放入服务器文件夹中。如果没有,请将 module.xml 放在 modules 文件夹中。

【讨论】:

【参考方案2】:

我更改了standalone.xml,它可以工作 以这种方式设置标签:

<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>

也就是说我加了标签,改变了内容

【讨论】:

以上是关于"WFLYCTL0412: 未安装的必需服务:" => ["jboss.jdbc-driver.mysql"]的主要内容,如果未能解决你的问题,请参考以下文章

Wildfly-Swarm 并通过资源适配器连接到外部 activemq:WFLYCTL0412

WildFly 9.0.1 WFLYCTL0158 处理程序“控制台”未找到

我从Wildfly中删除了ExampleDS。现在我无法部署我的应用程序,因为我遇到了这样的错误。有什么提示吗?

Sql Server JDBC无法在wildfly AS上运行

TypeError:“digest”参数是必需的,不能未定义

Terraform 0.15.1 多提供者问题 - 参数“region”是必需的,但未设置