3 Replies Latest reply on Mar 12, 2009 2:46 AM by nashprimaya

    JBoss native windows service won't start/stop cleanly

    peter.lyons

      I am trying to use the JBoss Native Windows Service to start/stop JBoss, but start won't work cleanly (details below), and because of that stop won't work.

      System Info: jboss-web-2.1.1-GA, jboss-native-2.0.6-windows-x86-ssl
      I have tried on Windows Server 2003 EE SP2 and Windows Server 2008 with identical results.

      Here is what I have discovered:

      1. The "service.bat" script from JBoss Native has a bug since it references the non-existant "run.bat" file instead of "startup.bat". I filed bug https://jira.jboss.org/jira/browse/JBNATIVE-71 for this, but it is trivial to workaround just by doing "copy startup.bat run.bat", so this is not causing me any problems.

      2. Once that is fixed, "service.bat start", "service.bat stop", and "service.bat install" and "service.bat uninstall" all seem to work correctly. However, starting the service from the Services Control Panel or via the "net start JBAS50SVC" command both misbehave in the same way. The actual jboss java process does indeed start and run correctly, but for some reason windows thinks the service started then stopped. Because of that, you cannot stop the service because windows incorrectly thinks it is not running. So the fact that "net start JBAS50SVC" does not work cleanly is the problem I am trying to solve. (In the nestat output below, the process listening on port 80 is jboss since I have it configured to listen on that port. Thus this shows it is indeed running)

      C:\Program Files\CDE\jboss-web-2.1.1.GA\bin>net start JBAS50SVC
      The JBoss Application Server 5.0 service is starting.
      The JBoss Application Server 5.0 service could not be started.
      
      The service did not report an error.
      
      More help is available by typing NET HELPMSG 3534.
      
      C:\Program Files\CDE\jboss-web-2.1.1.GA\bin>netstat -an | find "80"
       TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
       TCP 0.0.0.0:8009 0.0.0.0:0 LISTENING
       TCP 127.0.0.1:8005 0.0.0.0:0 LISTENING
      
      C:\Program Files\CDE\jboss-web-2.1.1.GA\bin>net stop JBAS50SVC
      The JBoss Application Server 5.0 service is not started.
      
      More help is available by typing NET HELPMSG 3521.



      Unfortunately, run.log does not seem to provide any clues:

      C:\Program Files\CDE\jboss-web-2.1.1.GA\bin>type run.log
      Starting JBoss Application Server 5.0 [2009-01-06 09:58:34]
      Using CATALINA_BASE: C:\Program Files\CDE\jboss-web-2.1.1.GA
      Using CATALINA_HOME: C:\Program Files\CDE\jboss-web-2.1.1.GA
      Using CATALINA_TMPDIR: C:\Program Files\CDE\jboss-web-2.1.1.GA\temp
      Using JRE_HOME: C:\Program Files\CDE\jboss-web-2.1.1.GA\..\cde_winpe_shar
      e


      Anyone have any insights into this problem? Thanks in advance.

        • 1. Re: JBoss native windows service won't start/stop cleanly
          peterj

          The startup.bat file calls that catalina.bat file passing "start" as an argument. This causes JBoss Web to run in a separate process, and the batch files to return. This is probably what is causing the issue. Go into the startup.bat file, and neer the end of the file, change the call line to read:

          call "%EXECUTABLE%" run %CMD_LINE_ARGS%

          The "run" option runs JBoss Web as a child process, and prevents the batch file from being exited until JBoss Web exits.

          • 2. Re: JBoss native windows service won't start/stop cleanly
            peter.lyons

            Thanks for the quick and clear reply. That makes sense. I applied the fix to both startup.bat and run.bat and that indeed solves the problem. The service can be cleanly started and stopped from the control panel or via "net" command line.

            • 3. Re: JBoss native windows service won't start/stop cleanly
              nashprimaya

              erm.. du you set the right path environment? do u use the wstools? i just finsih up my days trouble shooting this... some part that i play:

              1. environment variable must be correct
              2. replace the jbosssvc.exe file
              3. trace use wstools
              4. play around