Wildfly 10无法在启动时加载MySQL XA驱动程序 [英] Wildfly 10 failing to load MySQL XA driver on startup

查看:170
本文介绍了Wildfly 10无法在启动时加载MySQL XA驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我在wildfly-10.0.0中部署的Web应用程序。它需要一个mysql xa驱动程序。我有以下错误:

I have a web application I am deploying in wildfly-10.0.0. It requires a mysql xa driver. I have the following error:


2015-10-13 12:25:37,979 ERROR [org.jboss.as.controller.management-操作](ServerService线程池 - 33)WFLYCTL0013:操作(添加)失败 - 地址:([
(subsystem=>datasources),
(jdbc-driver= >com.mysql)
]) - 失败描述:WFLYJCA0041:无法加载驱动程序模块[com.mysql]

2015-10-13 12:25:37,979 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 33) WFLYCTL0013: Operation ("add") failed - address: ([ ("subsystem" => "datasources"), ("jdbc-driver" => "com.mysql") ]) - failure description: "WFLYJCA0041: Failed to load module for driver [com.mysql]"

模块目录如下:

 Directory of C:\Users\rball\Documents\Dev\WildFly\wildfly-10.0.0.CR1\modules\sy
stem\layers\base\com\mysql\main

10/13/2015  11:32 AM    <DIR>          .
10/13/2015  11:32 AM    <DIR>          ..
10/13/2015  12:25 PM             1,575 module.xml
03/17/2015  05:21 AM           968,670 mysql-connector-java-5.1.35-bin.jar

module.xml文件是:

The module.xml file is:

   <?xml version="1.0" encoding="UTF-8"?>    

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

我将驱动程序和数据源添加到standalone.xml的datasources部分:

I added the driver and datasource to the datasources section of standalone.xml:

<xa-datasource jndi-name="java:/jdbc/MyXaDS" pool-name="MyXaDSPool" enabled="true" use-ccm="false">
                <xa-datasource-property name="URL">
                    jdbc:mysql://localhost:3306/temp?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8
                </xa-datasource-property>
                <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                <driver>com.mysql</driver>
                <xa-pool>
                    <min-pool-size>10</min-pool-size>
                    <max-pool-size>20</max-pool-size>
                    <is-same-rm-override>false</is-same-rm-override>
                    <interleaving>false</interleaving>
                    <pad-xid>false</pad-xid>
                    <wrap-xa-resource>false</wrap-xa-resource>
                </xa-pool>
                <security>
                    <user-name>root</user-name>
                    <password>password</password>
                </security>
                <validation>
                    <validate-on-match>false</validate-on-match>
                    <background-validation>false</background-validation>
                    <background-validation-millis>1000</background-validation-millis>
                </validation>
                <statement>
                    <prepared-statement-cache-size>0</prepared-statement-cache-size>
                    <share-prepared-statements>false</share-prepared-statements>
                </statement>
            </xa-datasource>
            <drivers>
                <driver name="com.mysql" module="com.mysql">
                    <driver-class>com.mysql.jdbc.Driver</driver-class>
                    <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                </driver>
            </drivers>


推荐答案

你得到的错误意味着wildfly需要一个名为 com.mysql 但它不存在或未以该名称注册。

The error you get means that wildfly expects a module called com.mysql but it doesn't exist or it isn't registered under that name.

您缺少一步,即注册数据源jdbc驱动程序。第一步当然是添加 mysql-connector-java-5.1.35-bin.jar 文件和 module.xml 中的文件WILDFLY_HOME\modules\system\layers\base\com\mysql\main

You are missing one step, which is registering the datasource jdbc driver. The first step of course being adding the mysql-connector-java-5.1.35-bin.jar file and module.xml file in WILDFLY_HOME\modules\system\layers\base\com\mysql\main.

要消除错误,请停止wildfly,删除这些行,删除standalone.xml中的驱动程序声明;我们将让/ subsystem命令创建此条目。

To get rid of your error, stop wildfly, delete the the driver declaration in your standalone.xml by removing these lines; We'll let the /subsystem command create this entry.

<driver name="com.mysql" module="com.mysql">
     <driver-class>com.mysql.jdbc.Driver</driver-class>
     <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>

打开命令提示符并导航到 WILDFLY_HOME\bin\ 并运行以下命令。

Open your command prompt and navigate to WILDFLY_HOME\bin\ and run the following commands.


  1. 运行以下命令连接到jboss cli: jboss -cli.bat --connect 。如果您的管理控制台在另一个端口上运行,例如localhost:9991,请使用 jboss-cli.bat --connect --controller = 127.0.0.1:9991

  1. Connect to jboss cli by running : jboss-cli.bat --connect . In case your management console is running on a different port say , localhost:9991, use jboss-cli.bat --connect --controller=127.0.0.1:9991

然后使用以下命令注册jdbc-driver

Then register the jdbc-driver with the following command

/ subsystem =数据源/ JDBC驱动器= com.mysql:添加(驱动程序名称= com.mysql,驱动器模块名= com.mysql,驾驶员XA-数据源类名= com.mysql.jdbc.jdbc2.optional。 MysqlXADataSource)

你应该得到回复 {结果=> 成功} 如果成功的话。
从那里,重新加载你的服务器,你应该摆脱那个错误。

You should get the response {"outcome" => "success"} if this was successful. From there, reload your server and you should get rid of that error.

我从此链接

这篇关于Wildfly 10无法在启动时加载MySQL XA驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆