9 Replies Latest reply on Dec 5, 2012 2:44 PM by Soto Roberto

    CLI deployment archive : deploy war with datasource and resource adapter

    Soto Roberto Newbie

      I am trying to encapsulate all deployment operations for an app into a CLI deployment archive.
      Components involved are a Microsoft SQL Server Datasource and its Driver, an ActiceMQ RAR JCA and, of course, my app as a WAR
      So I'm packaging them int the CLI archive as such

      \-
       |--META-INF
          |--MANIFEST.MF
       |--myApp.war
       |--activemq-rar-5.6.0.rar
       |--jtds-1.2.6.jar
       |--deploy.scr
       |--undeploy.scr

       

      Let's focus on the deploy.scr file (since I need something deployed in order to undeploy it )

      /subsystem=resource-adapters/resource-adapter=activemq-rar-5.6.0.rar:add(archive=activemq-rar-5.6.0.rar)
      deploy jtds-1.2.6.jar
      data-source add --name=myDS --connection-url=jdbc:jtds:sqlserver://server:1433/DB --jndi-name=java:jboss/datasources/myDS --driver-name=jtds-1.2.6.jar
      deploy myApp.war

       

      This throws the following exception when deploying the WAR

      17:05:58,006 ERROR [org.jboss.as.server] (management-handler-thread - 4) JBAS015870: Deploy of deployment "myApp.war" was rolled back with the following failure message: 
      {"JBAS014771: Services with missing/unavailable dependencies" => [
          "jboss.persistenceunit.\"myApp.war#myDB\" is missing [jboss.naming.context.java.jboss.datasources.myDS]",
          "jboss.deployment.unit.\"myApp.war\".component.MyMDB.CREATE is missing [jboss.ra.\"activemq-rar-5.6.0\"]",
      ]}
      

       

      If I exclude the sentence "deploy myApp.war" from deploy.scr, the script does finish... i.e. the datasource and resource adapter are, apparently, correctly deployed, and are indeed visible in the administration console. However, placing afterwards the WAR in the deployments/ directory will throw the same exception.

       

      Therefore, I suspect my datasource and adapter might not have been correctly configured... In particular, I suspect they might lack their JNDI names so my App cannot reference them, or something alike.

       

      This, unfortunately, I cannot check it since the JNDI View is broken in the nightly build (JBoss 7.2.0.Alpha1-SNAPSHOT, see >> or >>)

       

      Please note that the project can be deployed if I configure the datasource as a module and the resource adapter in standalone.xml, so it's not the code, but I'm interested into simplifying deploy to multiple servers and bootstrap for new developers.

       

      Not sure if it's really a bug though, or if I'm missing some configuration for this to work... so any kind of pointers are welcome.
      Thanks

        • 1. Re: CLI deployment archive : deploy war with datasource and resource adapter
          Nicklas Karlsson Master

          Can the WAR be deployed if you define the DS as a normal driver module?

          • 2. Re: CLI deployment archive : deploy war with datasource and resource adapter
            Soto Roberto Newbie

            Yes it can, however, to this respect my doubt is can a module be defined from the deployment archive?

            • 3. Re: CLI deployment archive : deploy war with datasource and resource adapter
              Soto Roberto Newbie

              UPDATE:

               

              I think I have resolved the RAR part of my issue by adding

              /subsystem=resource-adapters/resource-adapter=activemq-rar-5.6.0.rar:add(archive=activemq-rar-5.6.0.rar)
              deploy activemq-rar-5.6.0.rar
              /subsystem=resource-adapters/resource-adapter=activemq-rar-5.6.0.rar:activate
              

               

              However, this only works calling the CLI with the --file param

              ./jboss-cli.sh -c --file=deploy.scr
              

               

              whereas the same commands inside a CLI deployment archive throws

              JBAS014654: Composite operation was rolled back","Operation step-3" => "rar not yet deployed"

               

              which, I guess, must be related to the archive being processed as a single operation (see >>)

              • 4. Re: CLI deployment archive : deploy war with datasource and resource adapter
                Soto Roberto Newbie

                UPDATE:

                 

                The datasource  was also missinng its activation, so, summarizing, this is a valid deploy.scr

                /subsystem=resource-adapters/resource-adapter=activemq-rar-5.6.0.rar:add(archive=activemq-rar-5.6.0.rar)
                deploy activemq-rar-5.6.0.rar
                /subsystem=resource-adapters/resource-adapter=activemq-rar-5.6.0.rar:activate
                deploy jtds-1.2.6.jar
                data-source add --name=myDS --connection-url=jdbc:jtds:sqlserver://server:1433/myDB --jndi-name=java:jboss/datasources/myDS --driver-name=jtds-1.2.6.jar
                data-source enable --name=myDS
                deploy uplanner.war
                

                (Note that this is valid on nighlty builds only, JBoss 7.1.1.Final (Brontes) still reproduces DuplicateService Exceptions >>)

                 

                Again, this will only work as a parameter to the --file parameter but not inside a CLI deployment archive.

                 

                So, finally, the issue I would like to bring up is that .cli files are unable to process successive operations that depend one on an other because of them being treated as a single operation. This issue is marked as resolved >> but apparently it isn't. Or may be it was resolved for data sources but not for resource adapters?

                 

                Greetings

                • 5. Re: CLI deployment archive : deploy war with datasource and resource adapter
                  Jesper Thorhauge Newbie

                  I did a new build after AS7-5616 was marked as resolved, and it still didn't work with data sources and .cli from within a CLI deployment archive.

                  • 6. Re: CLI deployment archive : deploy war with datasource and resource adapter
                    Soto Roberto Newbie

                    Let me check if data sources are really working for me, may be I'm supposing the error is in the resource adapter only just because it's the first error I get...

                    • 7. Re: CLI deployment archive : deploy war with datasource and resource adapter
                      Soto Roberto Newbie

                      Nopes, my data source does work on its own, indeed:


                      If I first deploy my resource adapter and leave inside the CLI deployment archive just the driver and WAR to be deployed together with the following deploy.scr

                      deploy jtds-1.2.6.jar
                      data-source add --name=myrDS --connection-url=jdbc:jtds:sqlserver://server:1433/DB --jndi-name=java:jboss/datasources/myDS --driver-name=jtds-1.2.6.jar
                      data-source enable --name=myDS
                      deploy myApp.war
                      

                       

                      Then

                      [standalone@localhost:9999 /] deploy test.cli

                       

                      gives me

                      #1 deploy jtds-1.2.6.jar    
                      #2 data-source add --name=myrDS --connection-url=jdbc:jtds:sqlserver://server:1433/DB --jndi-name=java:jboss/datasources/myDS --driver-name=jtds-1.2.6.jar
                      #3 data-source enable --name=myDS
                      #4 deploy myApp.war
                      

                       

                      and my app is accessible.

                       

                      So, the issue is positively that resource adapters can't be deployed in a single operation, because the deployment archive given in my previous post throws

                      Failed to execute archive script: {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {
                      "Operation step-2" => "JBAS014654: Composite operation was rolled back","Operation step-3" => "rar not yet deployed",
                      "Operation step-4" => "JBAS014654: Composite operation was rolled back",
                      "Operation step-7" => "JBAS014654: Composite operation was rolled back"}}

                       

                      Shall I open a new issue for this then?

                      • 9. Re: CLI deployment archive : deploy war with datasource and resource adapter
                        Soto Roberto Newbie

                        Same issue in batch mode:

                        [standalone@localhost:9999 / #] list-batch
                        #1 /subsystem=resource-adapters/resource-adapter=activemq-rar-5.6.0.rar:add(archive=activemq-rar-5.6.0.rar)
                        #2 deploy activemq-rar-5.6.0.rar
                        #3 /subsystem=resource-adapters/resource-adapter=activemq-rar-5.6.0.rar:activate
                        #4 deploy jtds-1.2.6.jar
                        #5 data-source add --name=myDS --connection-url=jdbc:jtds:sqlserver://server:1433/DB --jndi-name=java:jboss/datasources/myDS --driver-name=jtds-1.2.6.jar
                        #6 data-source enable --name=myDS
                        #7 deploy myApp.war
                        

                         

                        results in

                        [standalone@localhost:9999 / #] run-batch
                        {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {
                        "Operation step-2" => "JBAS014654: Composite operation was rolled back","Operation step-3" => "rar not yet deployed",
                        "Operation step-4" => "JBAS014654: Composite operation was rolled back",
                        "Operation step-7" => "JBAS014654: Composite operation was rolled back"}}