1 Reply Latest reply on Aug 31, 2015 6:25 AM by Xavier Gibert

    Re-deploy EAR with Service crashes

    Xavier Gibert Newbie

      Hello,

       

      I have an EAR that I deploy in a JBoss Application Server. It contains a ServiceActivatorSingleton that starts a TimerSingleton to execute asynchronous tasks in a cluster, and switch the service from one node to another one when the current node is closed.

       

      All this works perfectly, I can see the service output in one terminal (Node 1), and when I close this node, the output of the service is shown in the second terminal (Node 2).

       

      If I try to re-deploy the EAR without restarting JBoss, it crashes and does not deploy. On the other hand, if I restart JBoss the deployment is done normally.

      I can imagine that the problem comes because there is still the first service running or declared when it tries to run the second one, but restarting JBoss kills all services. (NOT REALLY SURE THIS IS THE CAUSE).

       

      This is the error that I get from JBoss after re-deploying:

       

      JBAS014774: Service status report

      JBAS014777:   Services which failed to start:      service jboss.deployment.subu

      nit."ses.prod.ear-1.0.0-SNAPSHOT.ear"."ses.prod.war-1.0.0-SNAPSHOT.war".componen

      t.ServicesActivatorSingleton.START: org.jboss.msc.service.StartException in serv

      ice jboss.deployment.subunit."ses.prod.ear-1.0.0-SNAPSHOT.ear"."ses.prod.war-1.0

      .0-SNAPSHOT.war".component.ServicesActivatorSingleton.START: Failed to start ser

      vice

       

      The need of restarting JBoss at each time was not so critic until now. Now we use a remote server with Jenkins to do integration tests. Apparently it redeploys automatically the EAR but does not restart the server, so after the second commit once included the service code, the deployment in Jenkins fails every time.

       

      Is there a way to kill all services or "to clean" JBoss at each re-deployment? At application side, should I verify that the service is not already running or declared and kill it manually?

       

      Thanks in advance

        • 1. Re: Re-deploy EAR with Service crashes
          Xavier Gibert Newbie

          I found out the solution:

           

          When creating the Singleton Service, there are automatically created two child services (ServiceName."service" and ServiceName."singleton"). This services are not removed automatically when removing the parent. THIS ISSUE HAS BEEN SOLVED IN JBOSS 7.1.3 ([AS7-5073] Removing singleton service should also remove child services. - JBoss Issue Tracker)

           

          Since I cannot change the Jboss version I had to find a workaround:

           

          When going to stop the parent service, I take the serviceName variable and I copy it in two new variables. I append each one as follows: serviceNameService.append("service") and serviceNameService.append("singleton") . Then, I use the same code to stop and wait for REMOVED state for the three services.

          I get two wanings telling me that the component is already stopped, but it actually works. You can redeploy the EAR without restarting JBoss.