1 2 Previous Next 15 Replies Latest reply: Mar 12, 2014 9:50 AM by Stephen Coy RSS

    More datasource configuration grief - 7.1.1-Final.

    Ben Cantrick Newbie

      I am stumped. I've read https://community.jboss.org/wiki/DataSourceConfigurationInAS7 but can't see why my config won't work.

       

      web.xml:

       


      <resource-ref>

      <description>Main Non-Tx DB Connection</description>

      <res-ref-name>jdbc/mainPoolNoTx</res-ref-name>

      <res-type>javax.sql.DataSource</res-type>

      <res-auth>Container</res-auth>

      </resource-ref>

       


      <resource-ref>

      <description>Main Tx DB Connection</description>

      <res-ref-name>jdbc/mainPoolTx</res-ref-name>

      <res-type>javax.sql.DataSource</res-type>

      <res-auth>Container</res-auth>

      </resource-ref>

       

       

      jboss-web.xml:

       

      <jboss-web>
              <resource-ref>
                      <res-ref-name>jdbc/mainPoolTx</res-ref-name>    <!-- Logical name only. -->
                      <jndi-name>java:/mainPoolTx</jndi-name> <!-- Real JNDI name. -->
              </resource-ref>
              <resource-ref>
                      <res-ref-name>mainPoolNoTx</res-ref-name>
                      <jndi-name>java:/mainPoolNoTx</jndi-name>
              </resource-ref>
      </jboss-web>
      

       

       

      mysql-ds.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <datasources xmlns="http://www.jboss.org/ironjacamar/schema">
      
              <!-- A non-transaction-safe data source. -->
          <datasource
                              jndi-name="java:/mainPoolNoTx"
                              pool-name="mainPoolNoTx">
                      <driver-class>com.mysql.jdbc.Driver</driver-class>
                      <connection-url>jdbc:mysql://localhost:3306/test</connection-url>
              <security> <user-name>foo</user-name> <password>bar</password> </security>
                      <transaction-isolation>TRANSACTION_NONE</transaction-isolation>         <!-- See http://docs.oracle.com/javase/6/d
      ocs/api/java/sql/Connection.html#field_detail -->
          </datasource>
      
              <!-- A transaction-safe data source. -->
          <datasource
                              jndi-name="java:/mainPoolTx"
                              pool-name="mainPoolTx">
                      <driver-class>com.mysql.jdbc.Driver</driver-class>
                      <connection-url>jdbc:mysql://localhost:3306/test</connection-url>
              <security> <user-name>foo</user-name> <password>bar</password> </security>
                      <transaction-isolation>TRANSACTION_SERIALIZABLE</transaction-isolation>         <!-- See http://docs.oracle.com/ja
      vase/6/docs/api/java/sql/Connection.html#field_detail -->
          </datasource>
      
      </datasources>
      

       

      The error I'm seeing:

       

      18:51:22,622 ERROR [org.jboss.as] (MSC service thread 1-6) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 11075ms - Started 191 of 305 services (37 services failed or missing dependencies, 76 services are passive or on-demand)

      18:51:22,835 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "appserver.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolTxjboss.naming.context.java.mainPoolTxMissing[jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolTxjboss.naming.context.java.mainPoolTx]","jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolNoTxjboss.naming.context.java.mainPoolNoTxMissing[jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolNoTxjboss.naming.context.java.mainPoolNoTx]"]}

      18:51:23,008 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-18) JBAS015877: Stopped deployment appserver.war in 174ms

      18:51:23,014 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report

      JBAS014775:    New missing/unsatisfied dependencies:

            service jboss.naming.context.java.mainPoolNoTx (missing) dependents: [service jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolNoTx]

            service jboss.naming.context.java.mainPoolTx (missing) dependents: [service jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolTx]

       

      18:51:23,021 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolTxjboss.naming.context.java.mainPoolTxMissing[jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolTxjboss.naming.context.java.mainPoolTx]","jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolNoTxjboss.naming.context.java.mainPoolNoTxMissing[jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolNoTxjboss.naming.context.java.mainPoolNoTx]"]}}}

       

       

      I would love any insight at all. I can't for the life of me figure out why JBoss believes "jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolNoTx" is undefined. Isn't that what mysql-ds.xml is doing, defining that?

        • 1. Re: More datasource configuration grief - 7.1.1-Final.
          jaikiran pai Master

          Where exactly have you placed the mysql-ds.xml?

          • 2. Re: More datasource configuration grief - 7.1.1-Final.
            Ben Cantrick Newbie

            Hi Jaikiran, thanks for dropping by.

             

            It's in $JBOSS_HOME/standalone/deployments/appserver.war/WEB-INF/mysql-jboss7-ds.xml

             

            (The full path is /home/bcantrick/jboss/jboss-as-7.1.1.Final/standalone/deployments/appserver.war/WEB-INF/mysql-jboss7-ds.xml , if that matters.)

             

            It's probably obvious by looking at the above path, but just in case... appserver.war/ is a directory. In other words, this is an exploded deployment.

             

            I'm starting the server with $JBOSS_HOME/bin/standalone.sh . I can post the output of the server run if that will help.

             

            Ummm... that's all the info I can think of at the moment. If there's any other info I can supply, just let me know.

            • 3. Re: More datasource configuration grief - 7.1.1-Final.
              Ben Cantrick Newbie

              Ben Cantrick wrote:

               

              jboss-web.xml:

               

              <jboss-web>

                      <resource-ref>

                              <res-ref-name>jdbc/mainPoolTx</res-ref-name>    <!-- Logical name only. -->

                              <jndi-name>java:/mainPoolTx</jndi-name> <!-- Real JNDI name. -->

                      </resource-ref>

                      <resource-ref>

                              <res-ref-name>mainPoolNoTx</res-ref-name>

                              <jndi-name>java:/mainPoolNoTx</jndi-name>

                      </resource-ref>

              </jboss-web>

               

               

              I pasted the above incorrectly. The second <res-ref-name> is not what I have in my actual file. My jboss-web.xml actually has:

               


              <resource-ref>

              <res-ref-name>jdbc/mainPoolNoTx</res-ref-name>

              <jndi-name>java:/mainPoolNoTx</jndi-name>

              </resource-ref>

               

              I don't know why I pasted it wrong yesterday. Maybe I had too much Mt. Dew?? In any event, the error is still the same:

               

              10:00:54,523 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment appserver.war in 149ms

              10:00:54,528 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report

              JBAS014775:    New missing/unsatisfied dependencies:

                    service jboss.naming.context.java.mainPoolNoTx (missing) dependents: [service jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolNoTx]

                    service jboss.naming.context.java.mainPoolTx (missing) dependents: [service jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolTx]

               

              10:00:54,536 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolTxjboss.naming.context.java.mainPoolTxMissing[jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolTxjboss.naming.context.java.mainPoolTx]","jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolNoTxjboss.naming.context.java.mainPoolNoTxMissing[jboss.naming.context.java.module.appserver.appserver.env.jdbc.mainPoolNoTxjboss.naming.context.java.mainPoolNoTx]"]}}}

               

               

              EDIT: Oh yes, when I hit ctrl-C to stop the server, this message shows up:

               

              10:13:03,148 INFO  [org.jboss.as.logging] JBAS011503: Restored bootstrap log handlers

              10:13:03,225 INFO  [org.apache.catalina.core.StandardContext] Container org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/] has not been started

              10:13:03,238 INFO  [com.arjuna.ats.jbossatx] ARJUNA032018: Destroying TransactionManagerService

              10:13:03,240 INFO  [com.arjuna.ats.jbossatx] ARJUNA032014: Stopping transaction recovery manager

              10:13:03,330 INFO  [org.apache.coyote.http11.Http11Protocol] Pausing Coyote HTTP/1.1 on http-bcjboss7-10.10.10.172-8080

              10:13:03,331 INFO  [org.apache.coyote.http11.Http11Protocol] Stopping Coyote HTTP/1.1 on http-bcjboss7-10.10.10.172-8080

              10:13:03,341 INFO  [org.jboss.as.controller] JBAS014774: Service status report

              JBAS014776:    Newly corrected services:

                    service jboss.naming.context.java.mainPoolNoTx (new available)

                    service jboss.naming.context.java.mainPoolTx (new available)

               

              10:13:03,379 INFO  [org.jboss.as] JBAS015950: JBoss AS 7.1.1.Final "Brontes" stopped in 201ms

               

              To me this looks like some of the .xml files are being processed only after I tell the server to stop. But that can't be right, can it?

              • 4. Re: More datasource configuration grief - 7.1.1-Final.
                jaikiran pai Master

                Could you attach the server.log? I would like to see whether the -ds.xml is being picked up.

                • 5. Re: More datasource configuration grief - 7.1.1-Final.
                  Ben Cantrick Newbie

                  Sure, no problem. Typical run is attached as "server.log"

                   

                  FWIW, I believe the -ds.xml is being picked up. I say that because when I put a syntax error in the -ds.xml, the server errors in a different way that indicates it has seen the syntax error inside the -ds.xml file. A log of a run that shows that is attached as "xml-error.log"

                   

                   

                  EDIT: Ack! The forum software auto-zipped my attachments! I hope that's okay. I'll look around and see if I can find a setting or something to turn that off...

                  • 6. Re: More datasource configuration grief - 7.1.1-Final.
                    jaikiran pai Master

                    For some reason the datasource isn't being bound in JNDI. If it was then you would be seeing messages like this:

                    10:54:38,782 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-13) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]

                    for your datasource definition. Would it be possible for you to attach the stripped down version of that war to reproduce this issue?

                    • 7. Re: More datasource configuration grief - 7.1.1-Final.
                      Ben Cantrick Newbie

                      Unfortunately, the .war directory is about 85 megs. I don't think it's possible to cut it down much, the modules are not well separated at all. (Always fun being called in to fix a decade-old codebase...)

                       

                      I think what would be better is for me to make a new .WAR from scratch that uses the same config files, but with drastically simplified code. I believe that I can make a single servlet in a single .java file that will demonstrate the problem accurately. But won't have to carry the hundreds of .class files worth of baggage that the current appserver.war requires. However, this may take an hour or two.

                       

                      I'll go get on that right away. If that's not a good idea for some reason, then post here in this discussion saying so, and the message will forward to my inbox and I'll stop working on it.

                       

                      Than you very much for your help. I really appreciate it.

                      • 8. Re: More datasource configuration grief - 7.1.1-Final.
                        jaikiran pai Master

                        Ben Cantrick wrote:

                         

                        I think what would be better is for me to make a new .WAR from scratch that uses the same config files, but with drastically simplified code. I believe that I can make a single servlet in a single .java file that will demonstrate the problem accurately. But won't have to carry the hundreds of .class files worth of baggage that the current appserver.war requires. However, this may take an hour or two.

                         

                        I'll go get on that right away. If that's not a good idea for some reason, then post here in this discussion saying so, and the message will forward to my inbox and I'll stop working on it.

                         

                         

                        I think that's a good idea. If you see it working in the sample application you might even figure out why it isn't working in your actual application. Take your time though, I'm off to bed now If you are able to reproduce it with that simple application then attach it here someone might be able to figure out what's wrong.

                        • 9. Re: More datasource configuration grief - 7.1.1-Final.
                          Ben Cantrick Newbie

                          Here's a simple reproduce case. Entirely different code, but the same config files and the same errors. The .java file is included in WEB-INF/classes/, but honestly things never get that far, it fails on deployment.

                           

                          In addition to the deployment/test.war/ directory, I've also included standalone/configuration/ and standalone/log/, as well as the bin/standalone.sh and .conf. The file came out large, but I swear it's not my fault. The JDBC driver .jar in WEB-INF/lib/ accounts for 767,492 bytes. And since .jars are already zip files, they don't really compress.

                           

                           

                          EDIT: Attachment removed. It was full of bad configs. I don't want anyone using it as an example, even partially.

                          • 10. Re: More datasource configuration grief - 7.1.1-Final.
                            jaikiran pai Master

                            I checked with the JCA team. Apparently, you can't use the driver-class in your -ds.xml. It's meant for standalone IronJacamar instance:

                            #jboss-as7 logs

                             

                            [10:30:12] <Jaikiran> maeste: got a minute?

                            [10:30:28] <maeste> Jaikiran: sure

                            [10:30:48] <Jaikiran> maeste: i'm looking at this user's issue https://community.jboss.org/message/737150#737150

                            [10:31:08] * maeste opening

                            [10:31:25] <Jaikiran> maeste: is a -ds.xml within a deployment expected to work if it just specific the driver-class (the driver is deployed within the app itself)?

                            [10:31:37] <Jaikiran> or does the driver have to be configured in the standalone*.xml for this to work?

                            [10:31:59] <Jaikiran> the logs give no clue why hte jndi binding isn't happening, although the -ds.xml is being picked up

                            [10:32:39] <maeste> hasve to be configured in standalone, or can be hot deployed if jdbc 4

                            [10:33:14] <maeste> but than ds have to sue <driver> element pointing to deployed driver (jar name in case of hot deployment)

                            [10:33:32] <Jaikiran> ah so effectively driver-class isn't allowed for -ds.xml

                            [10:33:40] <Jaikiran> that probably is the issue then

                            [10:34:00] <maeste> yup I thnk so. Driver class works only in standaolne IJ

                            [10:34:07] <Jaikiran> thanks

                            [10:34:19] <maeste> you are welcome

                            For -ds.xml you'll have to configure the driver either as a module or deploy the driver separately and then use the <driver> element to point to the driver name (not driver-class name). Can you give that a try and see if that helps?

                            • 11. Re: More datasource configuration grief - 7.1.1-Final.
                              Ben Cantrick Newbie

                              Trying it now...

                               

                              EDIT:

                               

                              Changing the <driver-class> line in -ds.xml to "<driver>mysql-connector-java-5.1.13-bin.jar</driver>" doesn't seem to work, however the error is different now:

                               

                              09:57:52,628 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-4) Starting Coyote HTTP/1.1 on http-bcjboss7-10.10.10.172-8080

                              09:57:53,125 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-11) JBoss Web Services - Stack CXF Server 4.0.2.GA

                              09:57:53,871 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-9) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]

                              09:57:54,131 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-10) JBAS015012: Started FileSystemDeploymentService for directory /home/bcantrick/jboss/jboss-as-7.1.1.Final/standalone/deployments

                              09:57:54,140 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found test.war in deployment directory. To trigger deployment create a file called test.war.dodeploy

                              09:57:54,148 INFO  [org.jboss.as.remoting] (MSC service thread 1-17) JBAS017100: Listening on bcjboss7/10.10.10.172:4447

                              09:57:54,148 INFO  [org.jboss.as.remoting] (MSC service thread 1-18) JBAS017100: Listening on bcjboss7/10.10.10.172:9999

                              09:57:54,606 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://10.10.10.172:9990

                              09:57:54,608 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 8986ms - Started 133 of 208 services (74 services are passive or on-demand)

                              09:58:24,291 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-23) JBAS015876: Starting deployment of "test.war"

                              09:58:25,544 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-16) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)

                              09:58:25,919 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "test.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.data-source.mainPoolTxjboss.jdbc-driver.mysql-connector-java-5_1_13-bin_jarMissing[jboss.data-source.mainPoolTxjboss.jdbc-driver.mysql-connector-java-5_1_13-bin_jar]","jboss.data-source.mainPoolNoTxjboss.jdbc-driver.mysql-connector-java-5_1_13-bin_jarMissing[jboss.data-source.mainPoolNoTxjboss.jdbc-driver.mysql-connector-java-5_1_13-bin_jar]"]}

                              09:58:25,954 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010409: Unbound data source [mainPoolNoTx]

                              09:58:25,955 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-15) JBAS010409: Unbound data source [mainPoolTx]

                              09:58:25,978 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-14) JBAS015877: Stopped deployment test.war in 60ms

                              09:58:25,983 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report

                               

                               

                              Now adding the MySQL driver as a module in standalone.conf and tweaking .xml files...

                               

                               

                              EDIT 2:

                               

                              Still doesn't seem to be working. Errors are similar, though not identical, to the ones at the start of the discussion. Typical output looks like:

                               

                              [bcantrick@titan bin]$ rm ../standalone/log/* ; ./standalone.sh

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

                               

                                JBoss Bootstrap Environment

                               

                                JBOSS_HOME: /home/bcantrick/jboss/jboss-as-7.1.1.Final

                               

                                JAVA: /usr/local/java/jdk1.6.0_22/bin/java

                               

                                JAVA_OPTS:  -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Djboss.bind.address=bcjboss7 -Djboss.bind.address.management=bcjboss7 -DBCONNECTED_CONFIG_DIR=/home/bcantrick/jboss/jboss-as-7.1.1.Final/standalone/deployments/appserver.war/WEB-INF

                               

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

                               

                              Listening for transport dt_socket at address: 8787

                              10:53:16,114 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA

                              10:53:16,365 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA

                              10:53:16,435 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting

                              10:53:18,269 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)

                              10:53:18,270 INFO  [org.xnio] XNIO Version 3.0.3.GA

                              10:53:18,314 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA

                              10:53:18,343 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.3.GA

                              10:53:18,391 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers

                              10:53:18,398 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem

                              10:53:18,417 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.

                              10:53:18,430 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem

                              10:53:18,440 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem

                              10:53:18,441 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem

                              10:53:18,451 INFO  [org.jboss.as.security] (MSC service thread 1-16) JBAS013100: Current PicketBox version=4.0.7.Final

                              10:53:18,481 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension

                              10:53:18,556 INFO  [org.jboss.as.connector] (MSC service thread 1-15) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)

                              10:53:18,567 INFO  [org.jboss.as.naming] (MSC service thread 1-22) JBAS011802: Starting Naming Service

                              10:53:18,584 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-19) JBAS015400: Bound mail session [java:jboss/mail/Default]

                              10:53:18,679 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)

                              10:53:18,701 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)

                              10:53:18,744 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-22) Starting Coyote HTTP/1.1 on http-bcjboss7-10.10.10.172-8080

                              10:53:18,752 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-14) JBoss Web Services - Stack CXF Server 4.0.2.GA

                              10:53:19,355 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-11) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]

                              10:53:19,903 INFO  [org.jboss.as.remoting] (MSC service thread 1-23) JBAS017100: Listening on bcjboss7/10.10.10.172:9999

                              10:53:19,903 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on bcjboss7/10.10.10.172:4447

                              10:53:19,908 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-11) JBAS015012: Started FileSystemDeploymentService for directory /home/bcantrick/jboss/jboss-as-7.1.1.Final/standalone/deployments

                              10:53:19,940 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found test.war in deployment directory. To trigger deployment create a file called test.war.dodeploy

                              10:53:20,275 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-10) JBAS015876: Starting deployment of "test.war"

                              10:53:21,056 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-18) MSC00001: Failed to start service jboss.deployment.unit."test.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."test.war".INSTALL: Failed to process phase INSTALL of deployment "test.war"

                                      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                                      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                                      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_22]

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

                                      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_22]

                              Caused by: java.lang.IllegalArgumentException: JBAS011043: Circular dependency installing java:module/env/jdbc/mainPoolNoTx

                                      at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.addJndiBinding(ModuleJndiBindingProcessor.java:239)

                                      at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:118)

                                      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                                      ... 5 more

                               

                              10:53:21,081 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "test.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"test.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"test.war\".INSTALL: Failed to process phase INSTALL of deployment \"test.war\""}}

                              10:53:21,110 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-19) JBAS015877: Stopped deployment test.war in 29ms

                              10:53:21,115 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report

                              JBAS014777:   Services which failed to start:      service jboss.deployment.unit."test.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."test.war".INSTALL: Failed to process phase INSTALL of deployment "test.war"

                               

                              10:53:21,121 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"test.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"test.war\".INSTALL: Failed to process phase INSTALL of deployment \"test.war\""}}}}

                              10:54:09,729 INFO  [org.jboss.as.logging] JBAS011503: Restored bootstrap log handlers

                              10:54:09,740 INFO  [org.jboss.as.connector.subsystems.datasources] JBAS010409: Unbound data source [java:jboss/datasources/ExampleDS]

                              10:54:09,775 INFO  [com.arjuna.ats.jbossatx] ARJUNA032018: Destroying TransactionManagerService

                              10:54:09,777 INFO  [com.arjuna.ats.jbossatx] ARJUNA032014: Stopping transaction recovery manager

                              10:54:09,787 INFO  [org.jboss.as] JBAS015950: JBoss AS 7.1.1.Final "Brontes" stopped in 37ms

                               

                              Here are the relevant (I think) XML files/snippets.

                               

                              standalone.xml:

                               


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

                              <datasources>

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

                              ue">


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

                              <driver>h2</driver>

                              <security>

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

                              <password>sa</password>

                              </security>

                              </datasource>

                              <drivers>

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

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

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

                              </driver>

                              </drivers>

                              </datasources>

                              </subsystem>

                               

                              web.xml:

                               


                              <!-- Resource refs for database connections. -->

                               


                              <resource-ref>

                              <description>Main Non-Tx DB Connection</description>

                              <res-ref-name>jdbc/mainPoolNoTx</res-ref-name>

                              <res-type>javax.sql.DataSource</res-type>

                              <res-auth>Container</res-auth>

                              </resource-ref>

                               


                              <resource-ref>

                              <description>Main Tx DB Connection</description>

                              <res-ref-name>jdbc/mainPoolTx</res-ref-name>

                              <res-type>javax.sql.DataSource</res-type>

                              <res-auth>Container</res-auth>

                              </resource-ref>

                               

                               

                              jboss-web.xml:

                               

                              <jboss-web>

                                      <resource-ref>

                                              <res-ref-name>jdbc/mainPoolTx</res-ref-name>    <!-- Logical name only. -->

                                              <jndi-name>java:comp/env/jdbc/mainPoolTx</jndi-name>    <!-- Real JNDI name. -->

                                      </resource-ref>

                                      <resource-ref>

                                              <res-ref-name>jdbc/mainPoolNoTx</res-ref-name>

                                              <jndi-name>java:comp/env/jdbc/mainPoolNoTx</jndi-name>

                                      </resource-ref>

                              </jboss-web>

                               

                               

                              mysql-jboss7-ds.xml:

                               

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

                              <!-- $Id: mysql-ds.xml,v 1.3.2.1 2004/12/01 11:46:00 schrouf Exp $ -->

                               

                              <!-- A few simple datasource definitions in JBoss 7(.1.1-Final) format. -->

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

                                       <!-- A non-transaction-safe data source. -->

                                  <datasource

                                                      jndi-name="java:comp/env/jdbc/mainPoolNoTx"

                                                      pool-name="mainPoolNoTx">

                                              <driver>mysql-module</driver>

                                              <connection-url>jdbc:mysql://server.com</connection-url>

                                      <security> <user-name>foo</user-name> <password>bar</password> </security>

                                              <transaction-isolation>TRANSACTION_NONE</transaction-isolation>         <!-- See http://docs.oracle.com/javase/6/docs/api/java/sql/Connection.html#field_detail -->

                                  </datasource>

                               

                                      <!-- A transaction-safe data source. -->

                                  <datasource

                                                      jndi-name="java:comp/env/jdbc/mainPoolTx"

                                                      pool-name="mainPoolTx">

                                              <driver>mysql-module</driver>

                                              <connection-url>jdbc:mysql://server.com<connection-url>

                                      <security> <user-name>foo</user-name> <password>bar</password> </security>

                                              <transaction-isolation>TRANSACTION_SERIALIZABLE</transaction-isolation>         <!-- See http://docs.oracle.com/javase/6/docs/api/java/sql/Connection.html#field_detail -->

                                  </datasource>

                              </datasources>

                               

                               

                              I can attach other files (logs, etc) if desired. Just let me know.

                              • 12. Re: More datasource configuration grief - 7.1.1-Final.
                                Ben Cantrick Newbie

                                After staring at the server output for a while, I thought it was possible that the problem was something to do with trying to bind to a JNDI name in "comp/env", when maybe the "comp/env" JNDI context didn't exist yet. So I changed the .xml files to omit the "comp/env" part of the JNDI names:

                                 

                                [bcantrick@titan WEB-INF]$ grep mainPool *.xml

                                jboss-web.xml:          <res-ref-name>jdbc/mainPoolTx</res-ref-name>    <!-- Logical name only. -->

                                jboss-web.xml:          <jndi-name>java:jdbc/mainPoolTx</jndi-name>     <!-- Real JNDI name. -->

                                jboss-web.xml:          <res-ref-name>jdbc/mainPoolNoTx</res-ref-name>

                                jboss-web.xml:          <jndi-name>java:jdbc/mainPoolNoTx</jndi-name>

                                mysql-jboss7-ds.xml:                    jndi-name="java:jdbc/mainPoolNoTx"

                                mysql-jboss7-ds.xml:                    pool-name="mainPoolNoTx">

                                mysql-jboss7-ds.xml:                    jndi-name="java:jdbc/mainPoolTx"

                                mysql-jboss7-ds.xml:                    pool-name="mainPoolTx">

                                web.xml:                <res-ref-name>jdbc/mainPoolNoTx</res-ref-name>

                                web.xml:                <res-ref-name>jdbc/mainPoolTx</res-ref-name>

                                [bcantrick@titan WEB-INF]$

                                 

                                 

                                Now the server output looks like this:

                                 

                                11:14:30,587 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)

                                11:14:30,636 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-1) JBoss Web Services - Stack CXF Server 4.0.2.GA

                                11:14:30,748 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-22) Starting Coyote HTTP/1.1 on http-bcjboss7-10.10.10.172-8080

                                11:14:31,253 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-13) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]

                                11:14:31,917 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-23) JBAS015012: Started FileSystemDeploymentService for directory /home/bcantrick/jboss/jboss-as-7.1.1.Final/standalone/deployments

                                11:14:31,920 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found test.war in deployment directory. To trigger deployment create a file called test.war.dodeploy

                                11:14:31,923 INFO  [org.jboss.as.remoting] (MSC service thread 1-10) JBAS017100: Listening on bcjboss7/10.10.10.172:4447

                                11:14:31,923 INFO  [org.jboss.as.remoting] (MSC service thread 1-3) JBAS017100: Listening on bcjboss7/10.10.10.172:9999

                                11:14:32,380 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://10.10.10.172:9990

                                11:14:32,382 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 4653ms - Started 134 of 209 services (74 services are passive or on-demand)

                                 

                                11:14:52,014 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-22) JBAS015876: Starting deployment of "test.war"

                                11:14:52,898 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-17) JBAS010400: Bound data source [jdbc/mainPoolNoTx]

                                11:14:52,901 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-15) JBAS010400: Bound data source [jdbc/mainPoolTx]

                                11:14:53,166 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "test.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.test.test.env.jdbc.mainPoolTxjboss.naming.context.java.jboss.java:jdbc.mainPoolTxMissing[jboss.naming.context.java.module.test.test.env.jdbc.mainPoolTxjboss.naming.context.java.jboss.java:jdbc.mainPoolTx]","jboss.naming.context.java.module.test.test.env.jdbc.mainPoolNoTxjboss.naming.context.java.jboss.java:jdbc.mainPoolNoTxMissing[jboss.naming.context.java.module.test.test.env.jdbc.mainPoolNoTxjboss.naming.context.java.jboss.java:jdbc.mainPoolNoTx]"]}

                                11:14:53,205 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010409: Unbound data source [jdbc/mainPoolTx]

                                11:14:53,206 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010409: Unbound data source [jdbc/mainPoolNoTx]

                                11:14:53,232 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-21) JBAS015877: Stopped deployment test.war in 67ms

                                11:14:53,237 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report

                                JBAS014775:    New missing/unsatisfied dependencies:

                                      service jboss.naming.context.java.jboss.java:jdbc.mainPoolNoTx (missing) dependents: [service jboss.naming.context.java.module.test.test.env.jdbc.mainPoolNoTx]

                                      service jboss.naming.context.java.jboss.java:jdbc.mainPoolTx (missing) dependents: [service jboss.naming.context.java.module.test.test.env.jdbc.mainPoolTx]

                                 

                                11:14:53,245 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.test.test.env.jdbc.mainPoolTxjboss.naming.context.java.jboss.java:jdbc.mainPoolTxMissing[jboss.naming.context.java.module.test.test.env.jdbc.mainPoolTxjboss.naming.context.java.jboss.java:jdbc.mainPoolTx]","jboss.naming.context.java.module.test.test.env.jdbc.mainPoolNoTxjboss.naming.context.java.jboss.java:jdbc.mainPoolNoTxMissing[jboss.naming.context.java.module.test.test.env.jdbc.mainPoolNoTxjboss.naming.context.java.jboss.java:jdbc.mainPoolNoTx]"]}}}

                                 

                                 

                                This is a slight improvement - at least the datasources are being bound now.

                                 

                                What's really got me stumped, though, is how JBoss can know that I'm going to eventually make a JNDI lookup() call for something along the lines of "[...].env.jdbc.mainPoolNoTx" even though none of the config files say anything about "env". I guess it could be peeking inside the .class file in WEB-INF/classes/... But from the errors, I get the impression that it never even gets that far. When I actually hit my servlet via HTTP, the JEE servlet Container will create the "comp/env" JNDI context. But I'm not hitting my servlet via HTTP - or at least a breakpoint I put in service() is never triggered. So how does JBoss know "env" is mixed up in all this?

                                 

                                It seems obvious to me that I'm missing some fundamental understanding of how modules are loaded, but the documentation I can find doesn't seem to be clarifying things. What am I doing wrong...

                                • 13. Re: More datasource configuration grief - 7.1.1-Final.
                                  Ben Cantrick Newbie

                                  At the request of my former employers, I've deleted a post in this thread that had identifying info in it.

                                   

                                  Sorry for any inconvenience.

                                  • 14. Re: More datasource configuration grief - 7.1.1-Final.
                                    swapnesh sharma Newbie

                                    were you able to find a workaround for this? Or i will have to go down the path of removing the references?

                                    1 2 Previous Next