2 Replies Latest reply on Nov 7, 2013 11:42 AM by Michał Kotra

    Jboss 7 - undeploy all ears before server startup

    Michał Kotra Newbie

      Hello,

       

      I have following problem. My application consist of two ear files (ears have dependencies, and the can not be deployed at the same time, like jboss 7 do).

      The deployment order is really important in this case, so I decided to switch off deployment scanner and deploy two ears using cli scrip to deploy it in proper order (ear1 first and then ear2):

       

      #!bin/sh

      sh /home/jboss/jboss/bin/jboss-cli.sh -c "deploy /home/jboss/ear1.ear"

      sh /home/jboss/jboss/bin/jboss-cli.sh -c "deploy /home/jboss/ear2.ear"

       

      and undeploy:

       

      #!/bin/sh

      sh /home/jboss/jboss/bin/jboss-cli.sh -c "undeploy ear2.ear"

      sh /home/jboss/jboss/bin/jboss-cli.sh -c "undeploy ear1.ear"


      Then i modified my /etc/init.d/jboss startup scripts as follows:

       

      start:

      - startup  jboss

      - undeploy ear2 and ear1 using cli scripts (if nothing is deployed this will give me proper message, but works - OK )

      - deploy ear1 and ear2 using cli scripts

       

      stop:

      - undeploy ear2 and ear1

      - shudtown jboss

       

      Everytihing works fine but there is one scenario that causes problem: jboss is not stopped by my startup script (sever crash, reboot, kill jboss PID etc).

       

      In this case my startup script works like that:

       

      - start jboss (there are old <deployments> entires in my standalone.xml config) - here is root of the problem, I don't want to deploy (In standard jboss parralell mode) everything at startup only to undeploy it, and then deploy it in correct order

      - undeploy cli-script - OK

      - deploy cli-script - OK

       

      Is there any way to skip ear deployment at startup, or do I have manually modify my server config xml file (ex. using sed to remove <deployment> entries)

       

      Thanks for any help,

       

      Michał