4 Replies Latest reply on Aug 30, 2013 6:00 AM by lafr

    How to refer to the jdbc module if the driver is registered as deployment

    goldwater

      Hi, everyone

       

      I just deploy ojdbc6.jar in AS7 as a regular jar file, and I have this confirmation message from console:

       

      10:56:20,416 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "ojdbc6.jar"

      10:56:21,487 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) JBAS010403: Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (

      version 11.2)

      10:56:21,489 INFO  [org.jboss.as.osgi] (MSC service thread 1-7) JBAS011907: Register module: Module "deployment.ojdbc6.jar:main" from Service Module Loader

      10:56:21,499 INFO  [org.jboss.as.server] (HttpManagementService-threads - 6) JBAS018559: Deployed "ojdbc6.jar"

       

      So I took the module name of such ojdbc driver deployment as "deployment.ojdbc6.jar:main", so I add this module as dependency into another application:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
        <deployment>
        <dependencies>
             <module name="deployment.ojdbc6.jar:main" />
        </dependencies>
        <exclusions>
             <module name="org.apache.log4j" />
             <module name="org.apache.commons.logging" />
             <module name="org.jboss.logging" />
             <module name="org.jboss.logging.jul-to-slf4j-stub" />
             <module name="org.jboss.logmanager" />
             <module name="org.jboss.logmanager.log4j" />
             <module name="org.slf4j" />
        </exclusions>
        </deployment>
      </jboss-deployment-structure>
      
      
      
      
      

       

      unfortunately, when I deploy the application, it gives me:

      10:59:34,448 INFO  [org.jboss.as.server] (HttpManagementService-threads - 7) JBAS015870: Deploy of deployment "MyApp.war" was rolled back

      with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"MyApp.war.war\".POST_MODULE

      Missing[JBAS014861: <one or more transitive dependencies>]","jboss.module.service.\"deployment.MyApp.war.war\".main Missing[jboss.module.spec.service.\"deployment.ojdbc6.jar:main\".main]"]}

      10:59:35,198 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015877: Stopped deployment MyApp.war.war in 749ms

       

      So now Jboss complaining about it cannot find the module, is there something I missed in the configuration, why the application cannot find the module then?

      How to refer to the jdbc driver if register as deployment?

       

      Another question is, to make various deployments and use this jdbc driver at same time, is it necessary to register this jdbc jar as global module in standalone.xml?

       

      Thanks in advance.

        • 1. Re: How to refer to the jdbc module if the driver is registered as deployment
          lafr

          The message with "deployment.ojdbc6.jar:main" is coming from the osgi subsystem.

          For the application server itself it's not a module. So I'd guess the name for the deployment is without :main. So try simply deployment.ojdbc6.jar.

          When I tried to add dependencies to deployed rar's to my app I went the simple way, adding a manifest entry to my ear file with:

          <ear.....>

          ...

              <manifest>

                  <attribute name="Dependencies" value="deployment.controller.rar, deployment.filesystem.rar"/>

              </manifest>

          </ear>

           

          Ah, why at all you want to add this dependency? You want to use classes of this jar in your app?

           

          I do not. I use JPA. So I do not need dependency. I simply define datasources xml referencing the the oracle driver as <driver>ojdbc6.jar</driver>.

          I know, it's not recommended to use such unmanaged deployments, but as we were used to do it this way we kept it this way. One drawback is, that you won't see them in web-console e.g.

          • 2. Re: How to refer to the jdbc module if the driver is registered as deployment
            goldwater

            Thank you for the wonderful answer, you're right I should use deployment.ojdbc6.jar, but your bonus information is even more helpful. Another interesting question is seems deployed jdbc is kind of faster that the jdbc registered as module, may be the deployed jdbc using connection pooling?

            • 3. Re: Re: How to refer to the jdbc module if the driver is registered as deployment
              sfcoy

              According to https://docs.jboss.org/author/display/AS72/DataSource+configuration,

              The recommended way to install a JDBC driver into the application server is to simply deploy it as a regular JAR deployment

              I'm not sure why you think the jar deployed datasource is faster. It would be interesting to see some actual measurements. All connection pooling is managed by JBossAS/WildFly in conjunction with the datasource configuration.

              1 of 1 people found this helpful
              • 4. Re: How to refer to the jdbc module if the driver is registered as deployment
                lafr

                Certainly you're right about deployment of driver.

                I mixed it up with the data source definition. There we still use the old fashioned way of deploying -ds.xml files instead of standalone.xml / jboss-cli.

                1 of 1 people found this helpful