9 Replies Latest reply on Mar 8, 2011 3:02 PM by fmozturk

    Call startService twice

    fmozturk

      Service Interface:

       

      package service;

       

      public interface MyServiceMBean extends org.jboss.system.ServiceMBean {

      }

       

      Service Class:

       

      package service;

       

      public class MyService extends org.jboss.system.ServiceMBeanSupport implements MyServiceMBean {

        public void startService() throws Exception {

          log.info("startService()");

        }

       

        public void stopService() throws Exception {

          log.info("stopService()");

        }

      }

       

      Service XML:

       

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

      <server>

        <mbean code="service.MyService" name="mydomain:service=test-service">

          <depends>jboss:service=Naming</depends>

        </mbean>

      </server>

       

      Jboss 6.0.0.Final run on Windows XP.

       

      When I deploy upper service for the first time, startService() method called just once as expected. After I undeploy service stopService() called and everything is OK.

      But each time when I deploy service after undeploying for first time, startService() called. After exactly 5 seconds later, stopService() called and after that startService() called again.

       

      I did not have this situation on Linux for the same configuration.

        • 1. Call startService twice
          jaikiran

          Fahrettin Mehmet Öztürk wrote:

           


          But each time when I deploy service after undeploying for first time, startService() called. After exactly 5 seconds later, stopService() called and after that startService() called again.

           

           

          How do you undeploy/redeploy that service? The 5 second interval tells me that the hot deployment scanner thinks that your deployment has changed (anything wrong with the last modified timestamp on the *-service.xml file or your jar containing that file?) and triggers a redeployment.

          • 2. Call startService twice
            fmozturk

            I deleted *-service.xml and saw stopService() call. After I waited a minute, I put *-service.xml file to deploy directory and log is as follows:

             

            10:40:26,434 INFO  [service.MyService] stopService()

            10:41:26,933 INFO  [service.MyService] startService()

            10:41:31,990 INFO  [service.MyService] stopService()

            10:41:32,022 INFO  [service.MyService] startService()

            • 3. Call startService twice
              jaikiran

              Where exactly is the *-service.xml placed? What's the last updated timestamp on it? Does that timestamp keep changing? And can you compare it with the server time?

              • 4. Call startService twice
                fmozturk

                Where exactly is the *-service.xml placed?

                 

                JBOSS_HOME/server/default/deploy

                 

                What's the last updated timestamp on it?

                 

                08/03/2011  11:50               193 test-service.xml

                 

                Does that timestamp keep changing?

                 

                No. I just delete file from deploy directory and put it again.

                 

                And can you compare it with the server time?

                 

                Server is running on development machine.

                • 5. Call startService twice
                  jaikiran

                  Fahrettin Mehmet Öztürk wrote:

                   


                   

                  And can you compare it with the server time?

                   

                  Server is running on development machine.

                  I actually meant that you compare the server time that you see in the log like this:

                   

                  10:41:32,022 INFO....

                  with the last modified timestamp on that *-service.xml file.

                   

                  Additionally, can you tell us if there are any (hidden) backup or some similar files created for this *-service.xml file in that deploy folder? I don't see a reason why the hot deployment scanner should think this to be a redeployment. So am just looking for some clues.

                  • 6. Re: Call startService twice
                    fmozturk

                    I attached my little application. Please forgive me for my instructions but I want to be sure, we are doing samethings.

                     

                    Thank you.


                    In build.xml change

                     

                    <property name="jboss_dir" value="C:/jboss-6.0.0.Final"/>

                     

                    value property to your Jboss 6.0.0.Final directory,

                     

                    start your server by default configuration on Microsoft XP,

                     

                    ant deploy   # startService() runs only once

                    ant undeploy # stopService() runs only once

                    ant deploy   # startService() runs, stopService() runs after 5 seconds and startService() runs

                    • 7. Re: Call startService twice
                      alesj

                      I've tested this on Mac and Winz7, and it works as expected.

                      • 8. Re: Call startService twice
                        alesj
                        I've tested this on Mac and Winz7, and it works as expected.

                        Unfortunately meaning you'll have to debug it yourself.

                         

                        Remote AS debuging should be easy.

                        If you have problems finding the wiki where remote debuging is explained, let me know.

                        • 9. Re: Call startService twice
                          fmozturk

                          Thank you very much for all your effort.