本文介绍了Wildfly 上的 Db2 驱动程序/数据源设置:无法为驱动程序加载模块 [com.ibm]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Wildfly 服务器(Wildfly.8.0.0-Final 和 8.1.0 也一样)上为 db2 配置数据源,但这样做时遇到了一些问题.

I am wanting to configure the data source for db2 on my wildfly server (Wildfly.8.0.0-Final and 8.1.0 as well.) and am running into some problems doing so.

我的研究告诉我这是一个两步过程

My research tells me this is a two step process

  1. 将驱动程序作为模块安装在 %JBOSS_HOME%/modules/com/ibm/main 目录中.
  2. 配置数据源子系统以将此模块作为驱动程序包含在您的连接设置中.

到目前为止,我已经使用以下 module.xml 在以下结构下安装了模块:

So far I have installed the module under the following structure with the following module.xml:

modules/
`-- com/
    `-- ibm/
        `-- main/
            |-- db2jcc4.jar
            |-- db2jcc_license_cu.jar
            |-- db2jcc_license_cisuz.jar
            `-- module.xml

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="com.ibm">
    <resources>
        <resource-root path="db2jcc4.jar"/>
        <resource-root path="db2jcc_license_cu.jar"/>
        <resource-root path="db2jcc_license_cisuz.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
        <module name="sun.jdk"/>
    </dependencies>
</module>

xml文件中<?...?>前没有空格.模块名称为com.ibm",数据源如下:

There is no space before the <?...?> in the xml file. the module name is "com.ibm" and the datasource is as follows:

<subsystem xmlns="urn:jboss:domain:datasources:2.0">
    <datasources>
        <datasource jndi-name="java:/jdbc/MyDS" pool-name="MyDS" enabled="true" use-java-context="true">
            <xa-datasource-property name="ServerName">myIP</xa-datasource-property>
            <xa-datasource-property name="PortNumber">1234</xa-datasource-property>
            <xa-datasource-property name="DatabaseName">MyDB</xa-datasource-property>
            <xa-datasource-property name="DriverType">4</xa-datasource-property>
            <driver>ibmdb2</driver>
            <pool>
                <min-pool-size>0</min-pool-size>
                <max-pool-size>50</max-pool-size>
            </pool>
            <security>
                <user-name>bob</user-name>
                <password>isyouruncle</password>
            </security>
            <validation>
                <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2ValidConnectionChecker"/>
                <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2StaleConnectionChecker"/>
                <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2ExceptionSorter"/>
            </validation>
        </datasource>
        <drivers>
            <driver name="ibmdb2" module="com.ibm">
                <xa-datasource-class>com.ibm.db2.jcc.DB2XADatasource</xa-datasource-class>
            </driver>
        </drivers>
    </datasources>
</subsystem>

加载服务器会产生这个错误:

The loading up of the server produces this error:

12:49:01,228 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 9) JBAS014613: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("jdbc-driver" => "ibmdb2")
]) - failure description: "JBAS010441: Failed to load module for driver [com.ibm]"

这反过来又导致我的数据源声明由于缺少驱动程序而无法加载.

Which in turn causes my datasource declaration to fail loading as the driver is missing.

我使用 旧文档 作为指南,因为没有似乎还可以用于野蝇.此文档显示了一些承诺,但似乎有点过时了.如果有人有任何设置这方面的经验,那么您的帮助将不胜感激.

I am using older documentation as a guide because there doesn't seem to be any available for wildfly as yet. this documentation shows some promise but it seems a little out of date. If anyone has had any experience setting this up then Your help would be much appreciated.

我想连接到 DB2 9.7.

请,谢谢.

推荐答案

这不是解决您的问题的方法,而是供未来访问者(像我一样)通过搜索相同的错误消息来解决此问题的参考:

This is not the solution to your problem but a reference for future visitors who (like me) come to this question by search of the same error message:

p>

今天我遇到了同样的问题,对我来说这是 module.xmlstandalone-full.xml 中的错误.在这两种情况下,模块名称都是 com.ibm.main,但它应该是 com.ibm.

Today I had the same problem, for me it was an error in module.xml and standalone-full.xml. In both cases the module name was given as com.ibm.main, but it should have been com.ibm.

简而言之:如果您遇到此消息并且仔细检查配置文件没有帮助,请重写它们.

So in short: If you encounter this message and double checking the config files doesn't help, rewrite them.

这篇关于Wildfly 上的 Db2 驱动程序/数据源设置:无法为驱动程序加载模块 [com.ibm]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-21 17:55