7 Replies Latest reply on Sep 7, 2011 1:47 AM by jaikiran

    if you can't make a module.xml...

    jedierikb

      I am trying to connect to an oracle db on openshift.

       

      I am following instructions from here.

       

      Since I cannot make a $JBOSS_HOME/modules/com/oracle/ojdbc6/main/ and write my own module.xml and move ojdbc6.jar there...  what should I do?

       

      I have tried bundling my ojdb6.jar into my deployed war, but am not sure where I should put the module.xml information.

        • 1. Re: if you can't make a module.xml...
          beve

          Hi,

           

          you can define a module with your deployment by adding a jboss-deployment-structure.xml to you WEB-INF directory.

          For details about the jboss-deployment-structure.xml file please refer to the "JBoss Deployment Structure File" section of the JBoss AS 7 Developers Guide.

           

          Regards,

           

          /Daniel

          1 of 1 people found this helpful
          • 2. Re: if you can't make a module.xml...
            jedierikb

            Your help is much appeciated.

             

            I am struggling to get my ear (jboss-deployment-structure.xml and ojdbc jars) to work with my war persistence.xml) and my server's standalone.xml.  This is what I am getting in my logs:

             

            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_24]

            Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Error loading jboss-structure.xml from /opt/vostok/cartridges/jboss-7.0.0/bundle/applications/sss/standalone/deployments/app.ear/META-INF/jboss-deployment-structure.xml

            at org.jboss.as.server.deployment.module.DeploymentStructureDescriptorParser.parse(DeploymentStructureDescriptorParser.java:402)

            at org.jboss.as.server.deployment.module.DeploymentStructureDescriptorParser.parse(DeploymentStructureDescriptorParser.java:375)

            at org.jboss.as.server.deployment.module.DeploymentStructureDescriptorParser.deploy(DeploymentStructureDescriptorParser.java:289)

            at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)

            ... 5 more

            Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[5,2]

            Message: Unexpected content of type 'element start' named '{urn:jboss:module:1.0}module'

             

            (I have the rest of the log should it be helpful to post more, but I think the relevent bits are included above -- I have a malformed jboss-deployment-structure.xml.

             

            My jboss-deployment-structure.xml is simple (and probably simply wrong too):

             

            <jboss-deployment-structure>

                      <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

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

                                <resources>

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

                                </resources>

                                <dependencies>

                                          <module name="javax.api"/>

                                </dependencies>

                      </module>

            </jboss-deployment-structure>

             

            And it goes in my ear like this:

             

            lib

                 ojdbc6.jar

            META-INF

                  application.xml

                  jboss-deployment-structure.xml

                  MANIFEST.MF

            app.war

             

             

            My standalone.xml is modified to include the following:


            <datasource jndi-name="java:/APPDev" pool-name="APPDev" enabled="true" use-java-context="true">

             

                      <!-- todo: use port 1521 when opnened on openshift -->

                      <connection-url>jdbc:oracle:thin:@1.2.3.4:3306:mydb</connection-url>

                      <driver-class>oracle.jdbc.OracleDriver</driver-class>

                      <driver>ojdbc6.jar</driver>

                      <security>

                                <user-name>xxx</user-name>

                                <password>xxx</password>

                      </security>

                      <validation>

                                <validate-on-match>false</validate-on-match>

                                <background-validation>false</background-validation>

                                <useFastFail>false</useFastFail>

                      </validation>

                      <statement>

                                <prepared-statement-cache-size>100</prepared-statement-cache-size>

                                <share-prepared-statements/>

                      </statement>

            </datasource>

             

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

                      <xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class>

            </driver>

             


            • 3. Re: if you can't make a module.xml...
              beve

              My jboss-deployment-structure.xml is simple (and probably simply wrong too):

              I've got a working example that you can find here. Perhaps you can without specifying the namespace attribute on the module element?

               

              Regards,

               

              /Daniel

              1 of 1 people found this helpful
              • 4. Re: if you can't make a module.xml...
                jedierikb

                Thank you for the reference.  I kept the structure of my war the same as described earlier and modified my jboss-deployment-structure.xml:

                 

                <jboss-deployment-structure>

                          <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                          <module name="deployment.com.oracle.ojdbc6">

                                    <resources>

                                              <resource-root path="."/>

                                    </resources>

                                    <dependencies>

                                              <module name="javax.api"/>

                                    </dependencies>

                          </module>

                </jboss-deployment-structure>

                 

                My jboss-deployment-structure is now being parsed, but there is an initial hiccup finding the ojdbc.jar (suggesting the libs in my ear are not being found?) and then a complete rollback after the app.war is deployed (but not before the war indicates it deployed a JDBC-compliant driver?).  I am confused.

                 

                My jboss-debug log reads as follows (with what look to me to be the pertinent pieces highligted in blue).  Any additional help figuring how to bundle up my ear for deployment on openshift and talkin' oracle is much appreciated.

                 

                =========================================================================

                 

                 

                  JBoss Bootstrap Environment

                 

                 

                  JBOSS_HOME: /opt/vostok/cartridges/jboss-7.0.0/bundle/applications/sss

                 

                 

                  JAVA: /opt/vostok/cartridges/jdk6-1.6.0/bundle/jdk/bin/java

                 

                 

                  JAVA_OPTS: -server -Xmx1177776k  -Djavaprobe.properties=/srv/web-apps/299891437861992638092112875744045040954/app/info/setup/jdk6-1.6.0/javaprobe.properties -Djava.library.path=/opt/vost$

                 

                 

                =========================================================================

                 

                 

                11:04:40,820 INFO  [org.jboss.modules] JBoss Modules version 1.0.1.GA

                11:04:42,289 INFO  [org.jboss.msc] JBoss MSC version 1.0.0.GA

                11:04:42,483 INFO  [org.jboss.as] JBoss AS 7.0.0.Final "Lightning" starting

                11:04:46,534 INFO  [org.jboss.as] creating http management service using network interface (management) port (9990) securePort (-1)

                11:04:46,550 INFO  [org.jboss.as.logging] Removing bootstrap log handlers

                11:04:46,567 INFO  [org.jboss.as.naming] (Controller Boot Thread) Activating Naming Subsystem

                11:04:46,679 INFO  [org.jboss.as.naming] (MSC service thread 1-2) Starting Naming Service

                11:04:46,695 INFO  [org.jboss.as.clustering.infinispan.subsystem] (Controller Boot Thread) Activating Infinispan subsystem.

                11:04:47,216 INFO  [org.jboss.as.clustering.jgroups.subsystem] (Controller Boot Thread) Activating JGroups subsystem.

                11:04:47,223 INFO  [org.jboss.as.security] (Controller Boot Thread) Activating Security Subsystem

                11:04:47,335 INFO  [org.jboss.remoting] (MSC service thread 1-2) JBoss Remoting version 3.2.0.Beta2

                11:04:47,347 INFO  [org.xnio] (MSC service thread 1-2) XNIO Version 3.0.0.Beta3

                11:04:47,472 INFO  [org.xnio.nio] (MSC service thread 1-2) XNIO NIO Implementation Version 3.0.0.Beta3

                11:04:48,350 INFO  [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-2) The Apache Tomcat Native library which allows optimal performance in production environments was$

                11:04:48,571 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) Listening on /127.0.0.1:9999

                11:04:48,723 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-1) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080

                11:04:48,753 INFO  [org.jboss.as.jmx.JMXConnectorService] (MSC service thread 1-1) Starting remote JMX connector

                11:04:49,527 INFO  [org.jboss.as.connector] (MSC service thread 1-1) Starting JCA Subsystem (JBoss IronJacamar 1.0.0.CR2)

                11:04:49,493 INFO  [org.jboss.as.ee] (Controller Boot Thread) Activating EE subsystem

                11:04:51,470 INFO  [org.jboss.as.deployment] (MSC service thread 1-2) Started FileSystemDeploymentService for directory /opt/vostok/cartridges/jboss-7.0.0/bundle/applications/sss/standalon$

                11:04:51,484 INFO  [org.jboss.as.deployment] (DeploymentScanner-threads - 1) Found app.ear in deployment directory. To trigger deployment create a file called app.ear.dodeploy

                11:04:51,710 INFO  [org.jboss.as.controller] (Controller Boot Thread) Service status report

                   New missing/unsatisfied dependencies:

                      service jboss.jdbc-driver.ojdbc6_jar (missing)

                 

                 

                11:04:51,727 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) Starting deployment of "app.ear"

                11:04:53,171 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "app.war"

                11:04:53,918 INFO  [org.jboss.jpa] (MSC service thread 1-2) read persistence.xml for primary

                11:04:55,558 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 11.2)

                11:04:56,274 ERROR [org.jboss.as] (MSC service thread 1-1) JBoss AS 7.0.0.Final "Lightning" started (with errors) in 16260ms - Started 144 of 217 services (26 services failed or missing de$

                11:04:56,479 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "app.ear" was rolled back with failure message Operation handler failed to complete

                11:04:56,483 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => "Operation hand$

                11:04:56,532 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) Stopped deployment app.war in 49ms


                • 5. Re: if you can't make a module.xml...
                  beve

                  Can you try adding a resource-root for the 'lib/ojdbc.jar' and see if that works?

                  <jboss-deployment-structure>

                        <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                        <module name="deployment.com.oracle.ojdbc6">

                             <resources>

                                 <resource-root path="lib/ojdbc.jar"/>

                             </resources>

                             <dependencies>

                                 <module name="javax.api"/>

                             </dependencies>

                        </module>

                  </jboss-deployment-structure>

                   

                  My understanding of using a resouce-root path of '.', is that resouces and classes that exist in the root of the archive are made available to the deployment module. But this would not include archives packaged in the deployment, which might explain the error you are seeing. 

                   

                  Regards,

                   

                  /Daniel

                  • 6. Re: if you can't make a module.xml...
                    jedierikb

                    Alas, I get a nearly identical error log.

                     

                    Since the error log is rather sparse on details, is there an option I've missed for verbosity?

                    • 7. Re: if you can't make a module.xml...
                      jaikiran

                      A new release of OpenShift Express have been made available in production https://www.redhat.com/openshift/forums/news-and-announcements/new-features-in-this-weeks-openshift-express-and-website-upgrade-0. This should help you in creating the oracle module as a static module (i.e. not creating it in the deployment archive) and deploying it:

                      - NEW! For JBoss developers we've added a modules directoryhttps://www.redhat.com/openshift/kb/kb-e1018-how-can-i-add-jboss-modules-to-an-express-app to the Git repo so users can easily add their own JBoss modules. Just add them to the .openshift/config/modules/ directory in your Git repo and push.

                      Give it a try and see if it covers your usecase.