10 Replies Latest reply on Aug 7, 2018 4:10 PM by Vinícius Garcia

    Datasource no Wildfly 10.1 em modo domain.

    Vinícius Garcia Newbie

      Instalei o Wildfly 10.1 em modo Domain como HA.

      São três máquina: master,slave-01, slave-02.

      A minha dificuldade é como utilizar a conexão "datasource" do oracle neste caso de domain.

      Em modo standalone sem problemas funciona perfeitamente. Mas não estou conseguindo em modo domain.

      Também aproveito para pedir o software de teste systemprops.war cluster-example.war.

      Se puderem me ajudar fico grato.

      Espero ter postado no lugar certo. Sou novo neste forum.

      adrianoschmidt

        • 1. Re: Datasource no Wildfly 10.1 em modo domain.
          Claudio Miranda Expert

          Oi Vinicius, no modo domínio, para usar um datasource é necessário

          1) instalar o driver jdbc como módulo

          2) criar um datasource com este driver jdbc

           

          Veja neste post como fazer isso: JDBC Driver Setup - Harald Pehl

          • 2. Re: Datasource no Wildfly 10.1 em modo domain.
            Vinícius Garcia Newbie

            Bom dia Claudio.

            O detalhe deste tutorial é que acabo chegando na mesma situação.

            Ao tentar fazer os comandos previstos no jboss-cli.sh (usando linux centos 7 e máquina virtual java 1.8.0_181) não é apresentado a ramificação "/subsystem=datasources" tanto nas máquinas slaves como nas maquina master.

             

             

            [domain@172.21.1.107:9990 /] /

            core-service               deployment-overlay         host                       interface                  path                       server-group               system-property

            deployment                 extension                  host-exclude               management-client-content  profile                    socket-binding-group

            [domain@172.21.1.107:9990 /] /

             

            Se puder ajudar fico grato.

            1 of 1 people found this helpful
            • 3. Re: Datasource no Wildfly 10.1 em modo domain.
              Vinícius Garcia Newbie

              Claudio.

               

              E quando tento inserir usando o terceiro código mostrado no artigo não é mostrado o driver-module-name.

               

              [domain@172.21.1.100:9990 /] /profile=default/subsystem=datasources/data-source=oracle:add(

              allocation-retry-wait-millis=         connection-listener-class=            initial-pool-size=                    query-timeout=                        transaction-isolation=

              allocation-retry=                     connection-listener-property=         jndi-name=                            reauth-plugin-class-name=             url-delimiter=

              allow-multiple-users=                 connection-url=                       jta=                                  reauth-plugin-properties=             url-selector-strategy-class-name=

              background-validation-millis=         datasource-class=                     max-pool-size=                        security-domain=                      use-ccm=

              background-validation=                driver-class=                         mcp=                                  set-tx-query-timeout=                 use-fast-fail=

              blocking-timeout-wait-millis=         driver-name=                          min-pool-size=                        share-prepared-statements=            use-java-context=

              capacity-decrementer-class=           enabled=                              new-connection-sql=                   spy=                                  use-try-lock=

              capacity-decrementer-properties=      enlistment-trace=                     password=                             stale-connection-checker-class-name=  user-name=

              capacity-incrementer-class=           exception-sorter-class-name=          pool-fair=                            stale-connection-checker-properties=  valid-connection-checker-class-name=

              capacity-incrementer-properties=      exception-sorter-properties=          pool-prefill=                         statistics-enabled=                   valid-connection-checker-properties=

              check-valid-connection-sql=           flush-strategy=                       pool-use-strict-min=                  track-statements=                     validate-on-match=

              connectable=                          idle-timeout-minutes=                 prepared-statements-cache-size=       tracking=

               

               

              [domain@172.21.1.100:9990 /] /profile=default/subsystem=datasources/data-source=oracle:add(d

              datasource-class=  driver-class=  driver-name=

              [domain@172.21.1.100:9990 /] /profile=default/subsystem=datasources/data-source=oracle:add(driver-name=oracle,driver-mo

               

              Tens alguma ideia?

               

              Grato.

              • 4. Re: Datasource no Wildfly 10.1 em modo domain.
                Claudio Miranda Expert

                Oi Vinicius, no modo domínio, deve ser prefixado o nome do profile, por exemplo /profile=full-ha. Para saber qual profile usar, veja na lista de server-group, para qual profile o server-group está associado. Por exemplo se minha aplicação será instalada no server-group "grupo-1" que está vinculado ao profile "full-ha"  então o driver e datasource deverão ser criados neste profile "full-ha".

                 

                Tanto a criação do driver e do datasource, pode ser feita pela interface gráfica (web console), exceto a cópia do arquivo jar e a criação do módulo (module.xml) no diretório modules. Note que este passo de copiar o arquivo .jar e definição do module.xml devem ser feitas em todos as máquinas host controllers.

                 

                Veja este post que explica sobre o modo domínio

                Operating modes - Latest WildFly Documentation - Project Documentation Editor

                • 5. Re: Datasource no Wildfly 10.1 em modo domain.
                  Claudio Miranda Expert

                  Na criação do datasource em /profile=full/subsystem=datasources/data-source=a:add você deve usar o parâmetro "driver-name" e não "driver-module-name". O parâmetro "driver-name" é o nome do driver criado em "/profile=full-ha/subsystem=datasources/jdbc-driver=meu_driver:add"

                  • 6. Re: Datasource no Wildfly 10.1 em modo domain.
                    Vinícius Garcia Newbie

                    É o problema não está evoluindo para uma solução.

                     

                    Nas máquinas master e slaves instalei o drive da oracle  "ojdbc8.jar" no caminho  /opt/wildfly/modules/system/layers/base/com/oracle/main/.

                     

                    Usei o arquivo module.xml conforme abaixo:

                     

                    <module xmlns="urn:jboss:module:1.3" name="com.oracle">

                        <resources>

                            <resource-root path="ojdbc8.jar"/>

                        </resources>

                        <dependencies>

                            <module name="javax.api"/>

                            <module name="javax.transaction.api"/>

                            <module name="javax.servlet.api"/>

                        </dependencies>

                    </module>

                     

                    Fiz a devida referencia no arquivo domain.xml:

                     

                    <driver name="oracle" module="com.oracle">

                            <datasource-class>oracle.jdbc.pool.OracleDataSource</datasource-class>

                    </driver>

                     

                    E quando tento aplicar o datasource usando a interface gráfica a coisa não progride.

                     

                    Unknown error

                    Unexpected HTTP response: 500  Request { "name" => "OracleDS", "jta" => true, "enabled" => true, "user-name" => "JBOSS8", "password" => "OYw2UbaJC", "jndi-name" => "java:/OracleDS", "use-ccm" => true, "valid-connection-checker-class-name" => "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", "pool-name" => "OracleDS_Pool", "connection-url" => "jdbc:oracle:thin:@harpia-scan.furb.br:1521/hml", "driver-name" => "oracle", "background-validation" => true, "stale-connection-checker-class-name" => "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker", "exception-sorter-class-name" => "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", "operation" => "add", "address" => [ ("profile" => "ha"), ("subsystem" => "datasources"), ("data-source" => "OracleDS") ] }  Response  Internal Server Error { "outcome" => "failed", "result" => undefined, "failure-description" => {"WFLYDC0074: Operation failed or was rolled back on all servers. Server failures:" => {"server-group" => {"main-furb-cluster-group" => {"host" => { "peugeot208.furb.br" => {"maq-01.peugeot208.furb.br" => { "WFLYCTL0080: Failed services" => {"org.wildfly.data-source.OracleDS" => "org.jboss.msc.service.StartException in service org.wildfly.data-source.OracleDS: WFLYJCA0033: Error during the deployment of OracleDS Caused by: org.jboss.msc.service.StartException in anonymous service: WFLYJCA0032: Unable to start the ds because it generated more than one cf"}, "WFLYCTL0412: Required services that are not installed:" => ["org.wildfly.data-source.OracleDS"], "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined }}, "peugeot3008.furb.br" => {"maq-01.peugeot3008.furb.br" => { "WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.oracle"], "WFLYCTL0180: Services with missing/unavailable dependencies" => [ "jboss.driver-demander.java:/OracleDS is missing [jboss.jdbc-driver.oracle]", "org.wildfly.data-source.OracleDS is missing [jboss.jdbc-driver.oracle]" ] }}, "peugeot308.furb.br" => {"peugeot308.furb.br" => { "WFLYCTL0080: Failed services" => {"org.wildfly.data-source.OracleDS" => "org.jboss.msc.service.StartException in service org.wildfly.data-source.OracleDS: WFLYJCA0033: Error during the deployment of OracleDS Caused by: org.jboss.msc.service.StartException in anonymous service: WFLYJCA0032: Unable to start the ds because it generated more than one cf"}, "WFLYCTL0412: Required services that are not installed:" => ["org.wildfly.data-source.OracleDS"], "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined }} }}}}}, "rolled-back" => true, "server-groups" => {"main-furb-cluster-group" => {"host" => { "peugeot208.furb.br" => {"maq-01.peugeot208.furb.br" => {"response" => { "outcome" => "failed", "result" => undefined, "failure-description" => { "WFLYCTL0080: Failed services" => {"org.wildfly.data-source.OracleDS" => "org.jboss.msc.service.StartException in service org.wildfly.data-source.OracleDS: WFLYJCA0033: Error during the deployment of OracleDS Caused by: org.jboss.msc.service.StartException in anonymous service: WFLYJCA0032: Unable to start the ds because it generated more than one cf"}, "WFLYCTL0412: Required services that are not installed:" => ["org.wildfly.data-source.OracleDS"], "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined }, "rolled-back" => true }}}, "peugeot3008.furb.br" => {"maq-01.peugeot3008.furb.br" => {"response" => { "outcome" => "failed", "result" => undefined, "failure-description" => { "WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.oracle"], "WFLYCTL0180: Services with missing/unavailable dependencies" => [ "jboss.driver-demander.java:/OracleDS is missing [jboss.jdbc-driver.oracle]", "org.wildfly.data-source.OracleDS is missing [jboss.jdbc-driver.oracle]" ] }, "rolled-back" => true }}}, "peugeot308.furb.br" => {"peugeot308.furb.br" => {"response" => { "outcome" => "failed", "failure-description" => { "WFLYCTL0080: Failed services" => {"org.wildfly.data-source.OracleDS" => "org.jboss.msc.service.StartException in service org.wildfly.data-source.OracleDS: WFLYJCA0033: Error during the deployment of OracleDS Caused by: org.jboss.msc.service.StartException in anonymous service: WFLYJCA0032: Unable to start the ds because it generated more than one cf"}, "WFLYCTL0412: Required services that are not installed:" => ["org.wildfly.data-source.OracleDS"], "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined }, "rolled-back" => true }}} }}} }
                    • 7. Re: Datasource no Wildfly 10.1 em modo domain.
                      Claudio Miranda Expert

                      O driver foi instalado no profile=ha ? Pode mostrar o resultado do seguinte comando, executado pelo jboss-cli.sh: /profile=ha/subsystem=datasources/jdbc-driver=*:read-resource

                      • 8. Re: Datasource no Wildfly 10.1 em modo domain.
                        Vinícius Garcia Newbie

                        Olá Claudio.

                        O print mostrado foi tirado da máquina master.

                        É isto?

                         

                        [wildfly@peugeot308 ~]$ /opt/wildfly/bin/./jboss-cli.sh -c --controller=172.21.1.100

                        [domain@172.21.1.100:9990 /] /profile=ha/subsystem=datasources/jdbc-driver=*:read-resource

                        {

                            "outcome" => "success",

                            "result" => [

                                {

                                    "address" => [

                                        ("profile" => "ha"),

                                        ("subsystem" => "datasources"),

                                        ("jdbc-driver" => "oracle")

                                    ],

                                    "outcome" => "success",

                                    "result" => {

                                        "deployment-name" => undefined,

                                        "driver-class-name" => undefined,

                                        "driver-datasource-class-name" => "oracle.jdbc.pool.OracleDataSource",

                                        "driver-major-version" => undefined,

                                        "driver-minor-version" => undefined,

                                        "driver-module-name" => "com.oracle",

                                        "driver-name" => "oracle",

                                        "driver-xa-datasource-class-name" => undefined,

                                        "jdbc-compliant" => undefined,

                                        "module-slot" => undefined,

                                        "profile" => undefined,

                                        "xa-datasource-class" => undefined

                                    }

                                },

                                {

                                    "address" => [

                                        ("profile" => "ha"),

                                        ("subsystem" => "datasources"),

                                        ("jdbc-driver" => "h2")

                                    ],

                                    "outcome" => "success",

                                    "result" => {

                                        "deployment-name" => undefined,

                                        "driver-class-name" => undefined,

                                        "driver-datasource-class-name" => undefined,

                                        "driver-major-version" => undefined,

                                        "driver-minor-version" => undefined,

                                        "driver-module-name" => "com.h2database.h2",

                                        "driver-name" => "h2",

                                        "driver-xa-datasource-class-name" => "org.h2.jdbcx.JdbcDataSource",

                                        "jdbc-compliant" => undefined,

                                        "module-slot" => undefined,

                                        "profile" => undefined,

                                        "xa-datasource-class" => undefined

                                    }

                                }

                            ]

                        }

                        [domain@172.21.1.100:9990 /]

                        Grato pela ajuda.

                        • 9. Re: Datasource no Wildfly 10.1 em modo domain.
                          Claudio Miranda Expert

                          Pode tentar criar o datasource por CLI ?

                          /profile=ha/subsystem=datasources/data-source=Oracle_ds:add(parametros...)

                          • 10. Re: Datasource no Wildfly 10.1 em modo domain.
                            Vinícius Garcia Newbie

                            Olá Claudio.

                             

                            A principio funcionou conforme pode ser visto abaixo.

                            Estes comandos eu digitei no servidor master (peugeot308)

                            Entrando na tela gráfica: runtime, server group, group-furb, e mostrado as 3 máquina.

                            Quando eu mando fazer o teste de conexão na máquina peugeot208(slave) acontece com sucesso.

                            Nas outras nem aparece o datasouce na lista.

                             

                            Tens alguma explicação.

                             

                            Grato.

                             

                            [domain@172.21.1.100:9990 /] /profile=ha/subsystem=datasources/data-source=ORACLEDS:add(driver-name=oracle,connection-url=jdbc:oracle:thin:@XXXXXXXXXXX:1521/xxx,jndi-name=java:/ORACLEDS,user-name=XXXXXX,password=XXXXXX,enabled=true,initial-pool-size=5,transaction-isolation=TRANSACTION_READ_COMMITTED,min-pool-size=1,max-pool-size=10,allow-multiple-users=false,valid-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker,check-valid-connection-sql="select 1 from dual",validate-on-match=true,background-validation=true,stale-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker,exception-sorter-class-name=org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter)

                            {

                                "outcome" => "success",

                                "result" => undefined,

                                "server-groups" => {"main-furb-cluster-group" => {"host" => {

                                    "peugeot208.xxxx.xx" => {"maq-01.peugeot208.xxxx.xx" => {"response" => {

                                        "outcome" => "success",

                                        "result" => undefined

                                    }}},

                                    "peugeot3008.xxxx.xx" => {"maq-01.peugeot3008.xxxx.xx" => {"response" => {

                                        "outcome" => "success",

                                        "result" => undefined

                                    }}},

                                    "peugeot308.xxxx.xx" => {"peugeot308.xxxx.xx" => {"response" => {"outcome" => "success"}}}

                                }}}

                            }

                             

                             

                            /profile=ha/subsystem=datasources/data-source=ORACLEDS:enable

                            {

                                "outcome" => "success",

                                "result" => undefined,

                                "server-groups" => {"main-furb-cluster-group" => {"host" => {

                                    "peugeot208.xxxx.xx" => {"maq-01.peugeot208.xxxx.xx" => {"response" => {

                                        "outcome" => "success",

                                        "result" => undefined

                                    }}},

                                    "peugeot3008.xxxx.xx" => {"maq-01.peugeot3008.xxxx.xx" => {"response" => {

                                        "outcome" => "success",

                                        "result" => undefined

                                    }}},

                                    "peugeot308.xxxx.xx" => {"peugeot308.xxxx.xx" => {"response" => {"outcome" => "success"}}}

                                }}}

                            }