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

jxct1oxe  于 2022-11-08  发布在  Mysql
关注(0)|答案(2)|浏览(319)

我正在尝试添加一个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的文件夹下

v64noz0r

v64noz0r1#

我更改了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>

也就是说,我添加了标记并更改了

jckbn6z7

jckbn6z72#

您服务器找不到我sql jar,请确认您必须将我sql jar也放在服务器文件夹中如果找不到,请将module.xml放在模块文件夹中

相关问题