WFLYCTL0412:未安装的必需服务:

时间:2016-09-01 21:42:11

标签: wildfly

我试图在Wildfly 10.0中添加数据源,但是当我测试连接时,会抛出错误消息:

Anchor['keystone::service::begin']

服务器日志中的错误:

Unexpected HTTP response: 500

Request
{
    "address" => [
        ("subsystem" => "datasources"),
        ("data-source" => "PostgreCrawlazo")
    ],
    "operation" => "test-connection-in-pool"
}

Response

Internal Server Error
{
    "outcome" => "failed",
    "failure-description" => "WFLYJCA0040: failed to invoke operation: WFLYJCA0042: failed to match pool. Check JndiName: java:/crawlazo",
    "rolled-back" => true,
    "response-headers" => {"process-state" => "reload-required"}
}

我从standalone.xml和module.xml复制相同的配置文件

这是我在standalone.xml中设置数据源的部分原因:

2016-09-01 16:28:40,524 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "PostgreCrawlazo")
]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => [
        "jboss.jdbc-driver.postgres",
        "jboss.jdbc-driver.postgres"
    ],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.driver-demander.java:/crawlazo is missing [jboss.jdbc-driver.postgres]",
        "org.wildfly.data-source.PostgreCrawlazo is missing [jboss.jdbc-driver.postgres]",
        "org.wildfly.data-source.PostgreCrawlazo is missing [jboss.jdbc-driver.postgres]"
    ]
}

和module.xml:

 <datasource jndi-name="java:/crawlazo" pool-name="PostgreCrawlazo" enabled="true">
                    <connection-url>jdbc:postgresql://x.x.x.x:5432/crawlazo</connection-url>
                    <driver>postgres</driver>
                    <pool>
                        <min-pool-size>1</min-pool-size>
                        <max-pool-size>40</max-pool-size>
                    </pool>
                    <security>
                        <user-name>someUser</user-name>
                        <password>somePasswd</password>
                    </security>
                </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                    <driver name="postgres" module="org.postgres">
                        <driver-class>org.postgresql.Driver</driver-class>
                    </driver>
            </drivers>

我在部署文件夹中有一个postgresql-9.2-1004.jdbc3.jar。

为什么会出现此错误?我可以忘记配置什么?

3 个答案:

答案 0 :(得分:8)

驱动程序jar应该位于模块文件夹中,而不是在部署文件夹中,因为您在写下时暗示了这一点:

<resources>
    <resource-root path="postgresql-9.2-1004.jdbc3.jar"/>
</resources>

答案 1 :(得分:6)

我的工作是这样的:

1 - 在WildFly安装目录中创建一个文件夹:    \模块\有机\ postgres的\主

2 - 在上面的文件夹中创建一个“module.xml”,内容为:

<?xml version='1.0' encoding='UTF-8'?>
<module xmlns="urn:jboss:module:1.1" name="org.postgres">

    <resources>
        <resource-root path="postgresql-9.4-1204-jdbc4.jar"/>
    </resources>

    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
        <module name="javax.servlet.api" optional="true"/>
    </dependencies>
</module>

3 - 将驱动程序JAR文件复制到步骤1的同一文件夹

4 - 在standalone.xml中添加数据源:

<datasource jta="false" jndi-name="java:jboss/datasources/YourDS" pool-name="YourDS" enabled="true" use-ccm="false">
    <connection-url>jdbc:postgresql://localhost:5432/yourDB</connection-url>
    <driver>postgres</driver>
    <security>
        <user-name>user</user-name>
        <password>pass/password>
    </security>
    <validation>
        <validate-on-match>false</validate-on-match>
        <background-validation>false</background-validation>
    </validation>
    <statement>
        <share-prepared-statements>false</share-prepared-statements>
    </statement>
</datasource>

<drivers>
    <driver name="postgres" module="org.postgres">
        <driver-class>org.postgresql.Driver</driver-class>
    </driver>
</drivers>

答案 2 :(得分:0)

  

这是我使用jboss-cli创建xa-datasources 的方式   控制台

首先,我在 / opt / wildfly / modules / system / layers / base / org / postgresql / main 上添加了驱动程序。注意我为驱动程序模块创建了文件,但我还添加了jar

[root@localhost main]# ls -lrta
total 776
drwxr-xr-x. 3 root    root        18 abr  4 17:10 ..
-rwxr-xr-x. 1 wildfly wildfly 790405 abr  4 17:14 postgresql-42.2.2.jar
-rwxr-xr-x. 1 wildfly wildfly    278 abr 17 17:25 module.xml
drwxr-xr-x. 2 root    root        53 abr 17 19:40 .
[root@localhost main]# cat module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.postgresql" >
<resources>
<resource-root path="postgresql-42.2.2.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>

接下来,我在控制台上创建了数据源

jboss-cli.sh --connect --controller=192.168.119.116:9990 --commands='xa-data-source add --name=FrontEndDSXA --profile=full --driver-name="postgresql" --enabled="true" --use-ccm="true" --jndi-name="java:jboss/datasources/FrontEndDSXA" --user-name="user" --password="password" --validate-on-match=true --background-validation=false --prepared-statements-cache-size=50 --share-prepared-statements=true --min-pool-size=5 --max-pool-size=150 --pool-prefill=true --transaction-isolation=TRANSACTION_READ_COMMITTED --check-valid-connection-sql="select 1;" --xa-datasource-properties={ "DatabaseName"=>"frontend", "PortNumber"=>"5432", "ServerName"=>"192.168.119.114" }'

接下来,将配置文件完整添加到domain.xml上的my-server-group

<server-groups>
    <server-group name="my-server-group" profile="full">
        <jvm name="default">
            <heap size="64m" max-size="512m"/>
        </jvm>
        <socket-binding-group ref="full-sockets"/>
    </server-group>
</server-groups>

最后,我重新加载了Wildfly(在我的情况下,主机默认为master

/opt/wildfly/bin/jboss-cli.sh --connect --controller=192.168.119.116:9990 --commands="reload --host=master"

现在,my-server-group上的所有服务器都可以看到数据源。

希望有所帮助