WFLYCTL0412: Required services that are not installed:

萝らか妹 提交于 2019-12-03 10:34:12
ehsavoie

The driver jar should be in the module folder not in the deployment folder as you are implying this when you wrote :

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

I got mine working like this:

1 - create a folder in the WildFly installation dir: \modules\org\postgres\main

2 - create a "module.xml" in the folder above with the content:

<?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 - copy the driver JAR file to the same folder of step 1

4 - add the datasource in 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>

This was the way I created my xa-datasources with jboss-cli console:

First, I added the driver on /opt/wildfly/modules/system/layers/base/org/postgresql/main. Notice I created the file for the driver module but I also added the 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>

Next, I created the datasource on console

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" }'

Next, added the profile full to my-server-group on domain.xml

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

Finally, I reloaded Wildfly (in my case, host was master as default)

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

Now, all the servers on my-server-group, can see the datasource.

Hope it helps

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!