1 Reply Latest reply on Dec 11, 2012 11:13 AM by keith_hall

    Deploying JDBC drivers and Datasources via jboss-cli.sh

    willemnoorduin

      In JBoss 7 / JBoss-EAP-6 I have made a domain-master (running on server1) and a slave (running on server2, and has server1 as its master. I have made a server-group and a server-config like this:

       

      [domain@server1:9999 server-group] /server-group=one-server-group/:add(profile=full-ha,socket-binding-group=full-ha-sockets,jvm=default)

      [domain@server1:9999 /] /host=server2/server-config=slave:add(auto-start=true, group=one-server-group, socket-binding-group=full-ha-sockets, socket-binding-port-offset=0)

      [domain@server1:9999 /] /host=server2/server-config=slave:start

       

      I would like deploy / add JDBC drivers and datasources via the cli, but:

       

      [domain@server1:9999 subsystem=datasources]  /host=server2/server=slave/subsystem=datasources/jdbc-driver=mysql:add(driver-name="mysql",driver-module-name="com.mysql.jdbc",driver-xa-datasource-class-name="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource")

      Failed to get the list of the operation properties: "JBAS014753: There is no operation add registered at address [

          ("subsystem" => "datasources"),

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

      ]"

       

      What do I do wrong. I can't reach the datasource subsystem of the master too, so I can't add it there either (of course, I can edit it manually to the domain.xml of the slave,, but then it still don't show up in my installed-drivers-list command.

       

      Or do you have to define all drivers and datasources on the master ?

        • 1. Re: Deploying JDBC drivers and Datasources via jboss-cli.sh
          keith_hall

          It's a bit confusing in the domain cli as the datasources are found in the /host/server/subsystem nodes as well as /profile/subsystem/ nodes

          However if you try looking at the available operations:

          [domain@127.0.0.1:9999 /] /host=master/server=server-three/subsystem=datasources/:read-operation-names

           

          you see

           

          {

              "outcome" => "success",

              "result" => [

                  "get-installed-driver",

                  "installed-drivers-list",

                  "read-attribute",

                  "read-children-names",

                  "read-children-resources",

                  "read-children-types",

                  "read-operation-description",

                  "read-operation-names",

                  "read-resource",

                  "read-resource-description"

              ]

          }

           

          and trying

           

          [domain@127.0.0.1:9999 /] /profile=full-ha/subsystem=datasources/:read-operation-names

           

          you see

           

          {

              "outcome" => "success",

              "result" => [

                  "add",

                  "read-attribute",

                  "read-children-names",

                  "read-children-resources",

                  "read-children-types",

                  "read-operation-description",

                  "read-operation-names",

                  "read-resource",

                  "read-resource-description",

                  "remove",

                  "undefine-attribute",

                  "whoami",

                  "write-attribute"

              ]

          }

           

          As you can see there is no add operation in the /host=master/server=server-three/subsystem=datasources node !!!

          Here's how I added the oracle jdbc driver to the full-ha profile in the domain - you will need to alter to suit mysql and relevant profile etc

           

           

          /profile=full-ha/subsystem=datasources/jdbc-driver=oracle:add( \

              driver-name="oracle", \

              driver-module-name="com.oracle.ojdbc6", \

              driver-xa-datasource-class-name="oracle.jdbc.driver.OracleDriver" \

          )

           

          and here's a datasource

          /profile=full-ha/subsystem=datasources/data-source=DefaultDS:add( \

              driver-name="oracle", \

              connection-url="jdbc:oracle:thin:@192.168.0.1:1521:orcl", \

              jndi-name="java:/DefaultDS", \

              user-name="user", \

              password="pass", \

              driver-class="oracle.jdbc.driver.OracleDriver", \

              min-pool-size=25, \

              max-pool-size=100, \

              pool-prefill=true, \

              transaction-isolation="TRANSACTION_READ_COMMITTED" \

          )

           

          enable it

          /profile=full-ha/subsystem=datasources/data-source=DefaultDS:enable

           

          and test it

           

          /host=master/server=server-three/subsystem=datasources/data-source=DefaultDS/:test-connection-in-pool

           

           

          notice the test is in the /host/server/subsystem/data-source node.

          1 of 1 people found this helpful