4 Replies Latest reply on Jul 27, 2014 12:35 PM by wdfink

    Understanding JDBC configuration in JBoss

    mark.drummond

      Hello everyone,

       

      JBoss newb here. I'm deploying EA 6.2.4 on RHEL 6.5. EAP is installed from the RH repos (/usr/share/jbossas). I have one master and two slaves. I've completed the first JBoss admin course, and I have a reasonable amount of experience with WebSphere Application Server (Network Deployment) and some Tomcat experience.

       

      I'm having a heck of time trying to understand JBDC driver installation and data source configuration. It may well be just me but I find the official docs sorely lacking in useful detail. Example code and commands are nice but there's no explanation of how things actually work, so the errors I get are largely meaningless to me.

       

      I'm trying to install the IBM DB2 JDBC v4 driver (DB2 9.7). This is what I have done so far:

       

      0. On all three hosts (master + two slaves):

      1. Created /usr/share/jbossas/modules/com/ibm/main/

      2. Drop db2jcc4.jar into main/, along with db2jcc_license_cu.jar

      3. Created the following modules.xml file:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <module xmlns="urn:jboss:module:1.1" name="com.ibm">

        <resources>

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

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

        </resources>

        <dependencies>

          <module name="javax.api"/>

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

        </dependencies>

      </module>

       

      4. Ran the following from the CLI on the master (I assume this is exactly the same if I run the CLI from a slave but tell it to connect to the master):

       

      [domain@10.10.220.177:9999 /] /profile=full/subsystem=datasources/jdbc-driver=db2jcc4:add(driver-name=db2jcc4,driver-module-name="com.ibm")

      (command output has since been lost)
      [domain@10.10.220.177:9999 /] /profile=full/subsystem=datasources/jdbc-driver=db2jcc4:read-resource(recursive=true)
      {
        "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.ibm",
        "driver-name" => "db2jcc4",
        "driver-xa-datasource-class-name" => undefined,
        "jdbc-compliant" => undefined,
        "module-slot" => undefined,
        "xa-datasource-class" => undefined
        }
      }

       

      Q. Does the above look correct? It looks like the driver is installed, and if I try using the data source configuration wizard from the console, it shows up in the list of recognized drivers. But I have a lot of undefined attributes.

       

      Q. The above command was run against a specific profile. Is it the case that a driver is always associated with a profile, and if I want to use the same driver with server-groups created with some other profile, I need to run the same command against that profile? The answer seems to be yes but again, not understanding how things work under the hood, I'd appreciate confirmation from someone more knowledgeable than me.

       

      Assuming the driver was installed, I tried setting up a data source from the CLI and the console. Results from the CLI:

       

      [domain@10.10.220.177:9999 /] /profile=full/subsystem=datasources/data-source=IndexDB:add(jndi-name=java:/indexdb,connection-url=jdbc:db2://[MYDBFQDN]:50011/iblindex,driver-name=db2jcc4,user-name=[MYDBUSERNAME],password=[MYDBPASSWORD])
      {
        "outcome" => "failed",
        "result" => undefined,
        "failure-description" => "JBAS010839: Operation failed or was rolled back on all servers.",
        "rolled-back" => true,
        "server-groups" => {
        "eidc-dev-group-1" => {"host" => {"kgneapdv02" => {"eidc-dev-server-1" => {"response" => {
        "outcome" => "failed",
        "result" => undefined,
        "rolled-back" => true
        }}}}},
        "fastandfull-dev-group-1" => {"host" => {"kgneapdv01" => {"fastandfull-dev-server-1" => {"response" => {
        "outcome" => "failed",
        "result" => undefined,
        "rolled-back" => true
        }}}}},
        "fatca-dev-group-1" => {"host" => {"kgneapdv01" => {"fatca-dev-server-1" => {"response" => {
        "outcome" => "failed",
        "result" => undefined,
        "failure-description" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.driver-demander.java:/indexdb is missing [jboss.jdbc-driver.db2jcc4]"]},
        "rolled-back" => true
        }}}}},
        "fg-iam-dev-group-1" => {"host" => {"kgneapdv01" => {"fg-iam-dev-server-1" => {"response" => {
        "outcome" => "failed",
        "result" => undefined,
        "failure-description" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.driver-demander.java:/indexdb is missing [jboss.jdbc-driver.db2jcc4]"]},
        "rolled-back" => true
        }}}}}
        }
      }


      Failures across the board, but oddly, the second two server groups provide a failure-description while the first two do not.


      Q. Is the above error meaningful to anyone? Google and RH support have so far not been able to help.


      Again, a data source appears to be associated with a profile, as opposed to a server-group or individual application. This seems to indicate that if I have a data source that I want only available to a single application, I need to create a profile for that application, and a server-group from that profile. Not really understanding the architectural decisions, this doesn't make much sense to me, and creating a new profile seems painful given there is no capability (yet) to clone a profile from the CLI. I assume the easiest way to do this is to cut and past in the domain.xml file, but that involves restarting the DC. Red Hat has an example CLI batch script for doing this but that script fails.


      Sorry for the long-winded post. In the end, I am just trying to understand how these pieces really go together.


      Thanks,

      Mark

        • 1. Re: Understanding JDBC configuration in JBoss
          mark.drummond

          An addendum to the above:

           

          I create a whole new profile (shut down, copy-paste "full" profile, rename) and re-ran the CLI commands to add the driver and the data source. I had to change the name of the driver resource but otherwise both commands completed successfully. Which gets me on my way but also brings me full circle: trying to understand what's happening under the hood such that the data source add failed previously and worked this time.

           

          Cheers,

          Mark

          • 2. Re: Understanding JDBC configuration in JBoss
            wdfink

            is it reproducable with the full profile?

            Normally it should be the same, or did you copy the full profile to XX but did not use it.

             

            Maybe you start with the master only and add the slave-host after it, it might depend on your configuration of server and server-groups.

            • 3. Re: Understanding JDBC configuration in JBoss
              mark.drummond

              I copied the entire "full" profile and gave it a new name. The only difference (as far as I know) between the "full" profile and this new profile is, the new one has a single server-group associated with it, while the full profile has three distinct server-groups associated with it.

               

              full profile: server-group-1, server-group-2, server-group-3

              new profile: server-group-4

               

              I also have not yet proved that the data source is actually working. The CLI commands to add the driver and to create the data source were successful (with the new profile), but I have yet to test the data source. I have a developer deploying an app to the new server-group to test the data source.

               

              I'm sure I will figure out how things are working under the hood with enough experimentation (and breaking things) but there is the usual pressure from work to have everything done yesterday.    

              • 4. Re: Understanding JDBC configuration in JBoss
                wdfink

                Did this Data Source Configuration in AS 7 helps?

                Maybe you configure all in the XML and see if that works.

                If yes you can try CLI and see that you have the same XML result.

                If there is any problem with CLI you should file a JIRA and provide the steps to reproduce