8 Replies Latest reply on Jan 28, 2016 12:33 PM by sarathm

    Oracle datasource setup using ds.xml

    sarathm

      I recently installed wildfly 9.0.2. Everything looks good except the datasource part.

       

      1) First I tried starting jboss by adding the datasource details in standalone.xml and everything works fine. JBoss started without any errors.

      2) Then I removed the datasource part from standalone.xml and created a ds.xml file and puhed that to deployment folder. This time I am getting below error

      2016-01-20 16:17:57,192 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) WFLYCTL0183: Service status report

      WFLYCTL0184:    New missing/unsatisfied dependencies:

            service jboss.data-source.reference-factory.java:/jboss/datasources/Oracle (missing) dependents: [service jboss.naming.context.java.jboss.datasources.Oracle]

       

       

      How I configured oracle driver.

      ------------------------------------------------

      Added ojdb6,jar and module.xml file under "/opt/wildfly/wildfly-9.0.2/modules/system/layers/base/com/oracle/main"

       

      module.xml

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

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

      <!-- Managed by Chef - local changes may be overwritten -->

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

          <resources>

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

          </resources>

          <dependencies>

              <module name="javax.api"/>

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

          </dependencies>

      </module>

       

       

      ds.xml file

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

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

      <datasources xmlns="http://www.jboss.org/ironjacamar/schema">

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

      <connection-url>jdbc:oracle:thin:@host:port:sid</connection-url>

      <driver>oracle</driver>

      <security>

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

          <password>admin</password>

      </security>

      </datasource>

      </datasources>

       

      Please help me in understanding what is wrong with the ds.xml file which is giving missing dependency errors.

        • 1. Re: Oracle datasource setup using ds.xml
          jaysensharma

          Can you please post the complete StackTrace of the error.   A little more Console output will give us the details.    That should give us the details like which application is dependent on the DataSource and whether the DataSource is getting deployed before it or later?   Or if there is any other reason of DataSource deployment failure.

           

           

          Regards

          Jay SenSharma

          • 2. Re: Oracle datasource setup using ds.xml
            sarathm

            hi Jay,

             

            Thanks for your reply. please find below the complete log

             

            2016-01-21 18:00:12,722 INFO  [org.jboss.as.naming] (MSC service thread 1-2) WFLYNAM0003: Starting Naming Service

            2016-01-21 18:00:12,885 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]

            2016-01-21 18:00:13,068 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 57) WFLYUT0014: Creating file handler for path /opt/wildfly/wildfly-9.0.2/welcome-content

            2016-01-21 18:00:14,079 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0012: Started server default-server.

            2016-01-21 18:00:14,584 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTP listener default listening on /0.0.0.0:8080

            2016-01-21 18:00:14,634 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0018: Host default-host starting

            2016-01-21 18:00:15,103 INFO  [org.wildfly.iiop.openjdk] (MSC service thread 1-2) WFLYIIOP0009: CORBA ORB Service started

            2016-01-21 18:00:15,433 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) WFLYDS0013: Started FileSystemDeploymentService for directory /opt/wildfly/wildfly-9.0.2/standalone/deployments

            2016-01-21 18:00:15,495 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0027: Starting deployment of "test-ds.xml" (runtime-name: "test-ds.xml")

            2016-01-21 18:00:15,823 INFO  [org.jboss.ws.common.management] (MSC service thread 1-2) JBWS022052: Starting JBoss Web Services - Stack CXF Server 5.0.0.Final

            2016-01-21 18:00:16,156 INFO  [org.hornetq.core.server] (ServerService Thread Pool -- 60) HQ221000: live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=/opt/wildfly/wildfly-9.0.2/standalone/data/messagingjournal,bindingsDirectory=/opt/wildfly/wildfly-9.0.2/standalone/data/messagingbindings,largeMessagesDirectory=/opt/wildfly/wildfly-9.0.2/standalone/data/messaginglargemessages,pagingDirectory=/opt/wildfly/wildfly-9.0.2/standalone/data/messagingpaging)

            2016-01-21 18:00:16,167 INFO  [org.hornetq.core.server] (ServerService Thread Pool -- 60) HQ221006: Waiting to obtain live lock

            2016-01-21 18:00:16,309 INFO  [org.hornetq.core.server] (ServerService Thread Pool -- 60) HQ221012: Using AIO Journal

            2016-01-21 18:00:16,827 INFO  [org.hornetq.core.server] (ServerService Thread Pool -- 60) HQ221043: Adding protocol support CORE

            2016-01-21 18:00:16,878 INFO  [org.hornetq.core.server] (ServerService Thread Pool -- 60) HQ221043: Adding protocol support AMQP

            2016-01-21 18:00:16,901 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]

            2016-01-21 18:00:16,955 WARN  [org.jboss.as.connector] (MSC service thread 1-2) WFLYJCA0091: -ds.xml file deployments are deprecated. Support may be removed in a future version.

            2016-01-21 18:00:17,058 INFO  [org.hornetq.core.server] (ServerService Thread Pool -- 60) HQ221043: Adding protocol support STOMP

            2016-01-21 18:00:17,227 INFO  [org.hornetq.core.server] (ServerService Thread Pool -- 60) HQ221034: Waiting to obtain live lock

            2016-01-21 18:00:17,234 INFO  [org.hornetq.core.server] (ServerService Thread Pool -- 60) HQ221035: Live Server Obtained live lock

            2016-01-21 18:00:18,735 INFO  [org.jboss.messaging] (MSC service thread 1-1) WFLYMSG0016: Registered HTTP upgrade for hornetq-remoting protocol handled by http-acceptor acceptor

            2016-01-21 18:00:18,737 INFO  [org.jboss.messaging] (MSC service thread 1-2) WFLYMSG0016: Registered HTTP upgrade for hornetq-remoting protocol handled by http-acceptor-throughput acceptor

            2016-01-21 18:00:19,073 INFO  [org.hornetq.core.server] (ServerService Thread Pool -- 60) HQ221007: Server is now live

            2016-01-21 18:00:19,073 INFO  [org.hornetq.core.server] (ServerService Thread Pool -- 60) HQ221001: HornetQ Server version 2.4.7.Final (2.4.7.Final, 124) [8266b978-c068-11e5-9d34-231f6e794f90]

            2016-01-21 18:00:19,153 INFO  [org.jboss.as.messaging] (ServerService Thread Pool -- 60) WFLYMSG0002: Bound messaging object to jndi name java:/ConnectionFactory

            2016-01-21 18:00:19,176 INFO  [org.hornetq.core.server] (ServerService Thread Pool -- 63) HQ221003: trying to deploy queue jms.queue.ExpiryQueue

            2016-01-21 18:00:19,268 INFO  [org.hornetq.jms.server] (ServerService Thread Pool -- 62) HQ121005: Invalid "host" value "0.0.0.0" detected for "http-connector" connector. Switching to "default-centos-59.vagrantup.com". If this new address is incorrect please manually configure the connector to use the proper one.

            2016-01-21 18:00:19,274 INFO  [org.jboss.as.messaging] (ServerService Thread Pool -- 62) WFLYMSG0002: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory

            2016-01-21 18:00:19,275 INFO  [org.hornetq.core.server] (ServerService Thread Pool -- 61) HQ221003: trying to deploy queue jms.queue.DLQ

            2016-01-21 18:00:19,360 INFO  [org.jboss.as.connector.deployment] (MSC service thread 1-2) WFLYJCA0007: Registered connection factory java:/JmsXA

            2016-01-21 18:00:19,494 INFO  [org.hornetq.ra] (MSC service thread 1-2) HornetQ resource adaptor started

            2016-01-21 18:00:19,495 INFO  [org.jboss.as.connector.services.resourceadapters.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-2) IJ020002: Deployed: file://RaActivatorhornetq-ra

            2016-01-21 18:00:19,503 INFO  [org.jboss.as.connector.deployment] (MSC service thread 1-1) WFLYJCA0002: Bound JCA ConnectionFactory [java:/JmsXA]

            2016-01-21 18:00:19,503 INFO  [org.jboss.as.messaging] (MSC service thread 1-1) WFLYMSG0002: Bound messaging object to jndi name java:jboss/DefaultJMSConnectionFactory

            2016-01-21 18:00:19,516 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "test-ds.xml")]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.data-source.java:/jboss/datasources/Oracle is missing [jboss.jdbc-driver.oracle]"]}

            2016-01-21 18:00:19,668 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "test-ds.xml" (runtime-name : "test-ds.xml")

            2016-01-21 18:00:19,673 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report

            WFLYCTL0184:    New missing/unsatisfied dependencies:

                  service jboss.jdbc-driver.oracle (missing) dependents: [service jboss.data-source.java:/jboss/datasources/Oracle]

             

             

            2016-01-21 18:00:20,241 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://0.0.0.0:9990/management

            2016-01-21 18:00:20,242 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://0.0.0.0:9990

            2016-01-21 18:00:20,242 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) started (with errors) in 16101ms - Started 274 of 439 services (3 services failed or missing dependencies, 211 services are lazy, passive or on-demand)

            2016-01-21 18:00:20,528 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-1) HV000001: Hibernate Validator 5.1.3.Final

            2016-01-21 18:00:20,663 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0010: Unbound data source [java:/jboss/datasources/Oracle]

            2016-01-21 18:00:20,686 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0028: Stopped deployment test-ds.xml (runtime-name: test-ds.xml) in 341ms

            2016-01-21 18:00:20,913 INFO  [org.jboss.as.repository] (DeploymentScanner-threads - 2) WFLYDR0002: Content removed from location /opt/wildfly/wildfly-9.0.2/standalone/data/content/e9/54f57b89907a83f95b3db41d17dee53c5332aa/content

            2016-01-21 18:00:20,913 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0009: Undeployed "test-ds.xml" (runtime-name: "test-ds.xml")

            2016-01-21 18:00:20,913 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) WFLYCTL0183: Service status report

            WFLYCTL0184:    New missing/unsatisfied dependencies:

                  service jboss.data-source.reference-factory.java:/jboss/datasources/Oracle (missing) dependents: [service jboss.naming.context.java.jboss.datasources.Oracle]

            • 3. Re: Oracle datasource setup using ds.xml
              jaysensharma

              The actual problem is following:

              service jboss.jdbc-driver.oracle (missing) dependents: [service jboss.data-source.java:/jboss/datasources/Oracle]

               

              In your ds.xml file you are referring to the driver as following: <driver>oracle</driver>     Which is not being found while initiating the DataSource.  Do you have the "oracle"  driver defined inside the <drivers> section of your standalone*.xml something like following:

               

              <driver name="oracle" module="com.oracle">
                    <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
              </driver>

               

               

              So just to isolate the issue can you please try deploying the Driver "ojdbc6.jar"  JAR also in the same deploy directory  "standalone/deployments"  and then edit the  ds.xml to include the file name as   <driver>ojdbc6.jar</driver>    then see if it works or not.       

               

              Also can you please share your standalone.xml  DataSource subsystem details here so that we can see if you have configured any <driver> tag there properly to define or not ?

               

              Regards

              Jay SenSharma

              • 4. Re: Oracle datasource setup using ds.xml
                sarathm

                Hi Jay,

                 

                Thanks for your update.

                 

                I copied ojdb6.jar to deploy folder & added <driver>ojdbc6.jar</driver> in ds file. It worked.    Thanks a lot. Please let me know if this is the correct method.

                 

                please find below the datasource subsystem in standalone.xml

                 

                <subsystem xmlns="urn:jboss:domain:datasources:2.0">

                            <datasources>

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

                                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>

                                    <driver>h2</driver>

                                    <security>

                                        <user-name>sa</user-name>

                                        <password>sa</password>

                                    </security>

                                </datasource>

                                <drivers>

                                    <driver name="h2" module="com.h2database.h2">

                                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>

                                    </driver>

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

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

                                    </driver>

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

                                        <driver-class>com.mysql.jdbc.Driver</driver-class>

                                        <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>

                                    </driver>

                                    <driver name="postgresql" module="org.postgresql">

                                        <driver-class>org.postgresql.Driver</driver-class>

                                        <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>

                                    </driver>

                                </drivers>

                            </datasources>

                        </subsystem>

                • 5. Re: Oracle datasource setup using ds.xml
                  jaysensharma

                  Your standalone.xml snippet of the datasource subsystem looks fine. However i will suggest here that rather than using the deployable "ds.xml" file you should define the datasource inside the standalone*.xml. Because the deployment datasource feature should only be used in development environments.

                   

                  As the deployable datasources are considered as unmanaged datasource. Those are not recommended for production environments, because those can not be managed by the JBoss Management console or the management utilities like jbpss-cli.sh. Hence such datasource cannot be managed like the managed dataSources which are configured inside the domain.xml or standalone*.xml files.

                  • 6. Re: Oracle datasource setup using ds.xml
                    sarathm

                    Thanks a lot Jay. it worked.