0 Replies Latest reply on Apr 28, 2002 7:49 AM by Lionel

    New NT Service HOWTO : Simplest One Yet

    Lionel Newbie

      I spent most of my Sunday doing this. I know of the javants.exe in the /contrib but that infernal thing has almost no documentation (some separate hyperlink) and bombs mysteriously.

      Instead, I got fed up and tried alternatives. Several in the FAQ for jboss but all 'convoluted' for just a simple developer like me who doesn't have a C++ compiler. Then I found this : JSL by Michael R


      I got it working in 1 hrs after tinkering only. It doesn't address jboss specifically but it was so simple, I easily adapted. My jsl.ini file is reproduced below. It isn't production quality but if u're using jboss, u're got enough IQ for it..;)

      appname = jboss
      servicename = jboss
      displayname = jboss

      ;port used to communicate stop command to JVM
      ;Must be unique for each JSL instance installed
      ;Used 8466 for jboss
      stopport = 8466

      ;service dependencies can be added
      ;as a comma separated string "dep1,dep2"

      ;service start type
      ;auto demand disabled
      ;default is auto

      ;load ordering group

      ;account under which service runs
      ;default is system

      ;password for above account
      ;system need not provide a password

      ;Allocate a console and register a console event handler to catch shutdown events.
      ;Default is true; options are FALSE TRUE false true YES NO yes no
      ;This option has two effects:
      ;1. If active it catches the logoff events and prevents the service from erroneously stopping in this case.
      ;2. It creates a console window if interaction with the desktop is allowd.
      ;Effect 1 can be achieved in Java 1.3.1 and higher by using the -Xrs option.
      ;Effect 2 may or may not be desired.

      ;Call . through JNI so stop the JVM.
      ;This can be used an alternative to the ServiceStopper
      ;When all three parameters are defined the JSL will try to use JNI to stop the service.
      ;If not it will use a tcp/ip connection to the stopport.
      ;The simplest way to use this functionality is to use the Systen.exit() call as specified below.
      ;Nevertheless you can call any static method in your code.
      ;The method called is expected to terminate the JVM one way or the other. It can directly
      ;call System.exit() or make another Thread do it make the main method return.
      ;The method can return imediately if desired. If the JVM doesn't stop another attempt can be made to
      ;stop the service at a later time.


      ;Take care to specify the right signature for your method. void System.exit( int code ) has
      ;the sifnature specified below. void myMethod() has the signature ()V. Please refer to the
      ;JNI documentation for details.

      ;Value of the PATH environement variable being set by the service.
      ;PATH will remain unchanged if this is empty.

      ;Redirect stdout and stderr to the specified files
      ;Leave empty for no redirection

      ;Behaviour in case of JVM exiting with an error
      ;Define whether an execption in the main method should be considered an error
      ;Use this exit code in case of an exception.

      ;Desired behaviour for a non zero exit code (including exceptions as specified above)
      ;ignore terminate without error (default)
      ;returncode exit with error code reported by the JVM to to the service manager
      ;fatal don't report regular service stop to service manager making it believe
      ;a fatal error had occured in the service (this is sometimes desirable if fatal error
      ;recovery mechanisms are in place)

      ;Use this executable for registering the service.
      ;Default is the executable used for installation

      ;Path to the java runtime used
      ;If this option is not used the default from the registry will be used

      ;working directory

      ;the number of paramters passed to the java application
      ;parameters must be numbered param00, param01 ...
      params = 6
      param00 = -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson.jaxp.DocumentBuilderFactoryImpl
      param01 = -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactoryImpl
      param02 = -cp
      param03 = D:\JBoss-2.4.5_Tomcat-4.0.3\jboss\bin;D:\jdk\jdk1.3.1_03\lib\tools.jar;run.jar;D:\JBoss-2.4.5_Tomcat-4.0.3\jboss\lib\crimson.jar
      param04 = org.jboss.Main
      param05 = catalina