13 Replies Latest reply on Sep 5, 2003 2:34 PM by dipaka

    How to run JBoss 3.0 as a Windows NT/2K/XP service


      1. Get JavaService from <http://www.alexandriasc.com/software/JavaService/index.html>.

      2. Download the attached tiny batch script.

      3. Copy JavaService.exe and the script into %JBoss_Home%\bin and run the latter which will show a short help.


        • 1. Re: How to run JBoss 3.0 as a Windows NT/2K/XP service


          1. The service name may contain spaces, but has to be enclosed in quotation marks then, e.g. "JBoss 3.0.2".

          2. System.out is saved to %JBoss_Home%\server\\log\stdout.log, System.err to stderr.log. Both files will be overwritten at service start.

          3. You may rename JavaService.exe to, for example, jboss.exe (and change the script accordingly) to be able to identify the service in the task manager.

          • 2. Re: How to run JBoss 3.0 as a Windows NT/2K/XP service

            Oh, and yes, this is exactly the same way Tomcat is run as a service. tomcat.exe is just a renamed JavaService.exe. ;)

            • 3. Re: How to run JBoss 3.0 as a Windows NT/2K/XP service
              Steve Lu Newbie

              You can only create a JBoss service which runs default server. I tried to pass -c all so start 'all' server in the script, it failed to recognize the option.

              • 5. Re: How to run JBoss 3.0 as a Windows NT/2K/XP service
                Luis JB Soeiro Newbie

                One more thing:

                Make sure the log directory already exists before you start the service. Although JBoss creates the directories for the application at start-up, it seems to do so after sending some messages to the console. This causes the service to fail to start because it can't open the OutputStream to send the messages.

                One tip: start Jboss once, shut it down, and then install it as a service. All required directories then will be already created.


                Luis Fernando Soeiro

                • 6. Re: How to run JBoss 3.0 as a Windows NT/2K/XP service

                  I first looked at JBoss about 18 months ago, but have been using Orion since then. Now I'm looking at providing full support for the use of both platforms for a J2EE application (with XDoclet to help).

                  I made use of JavaService to run Orion, and then modified the code to include a Windows service dependency - so that the database server would be run up before the application server tried to connect to it.

                  The modified version of the JavaService software is available at www.multiplan.co.uk/software/javaservice should anyone want to try it.

                  This also includes a sample script to run JBoss, based on comments in the quick-start document. I've yet to find out if other changes are needed to the script, but thought it worthwhile to post information about the updated software on this forum in the mean time...

                  • 7. Re: How to run JBoss 3.0 as a Windows NT/2K/XP service
                    harlequinn Newbie

                    Hmm, there seems to be a problem running JBoss with JavaService - at least on certain configurations.

                    I'm trying to get it to work on Windows 2000 server, running latest version of JavaService, and jboss-3.2.1_tomcat-4.1.24. When I run it from command line everything works really nice. When I register it as a service using JavaService and the script provided here, I get it to boot up, but log is filled with ClassNotFoundExceptions, and for example mail services don't work at all.

                    This has been discusses in Installation forum as well, http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= I'm guessing this is a classpath issue with JavaService, and perhaps has to do with built-in tomcat as well? I'd sure like to get this sorted out.

                    Here's my install script (Yes, I changed JavaService.exe to JBossService.exe - I had one line importing just the tools.jar, run.jar and shutdown.jar, but that didn't even boot up so I had to import also concurrent.jar and a few others)

                    @echo off
                    echo Installing JBoss as service on Windows NT/2K/XP
                    echo -----------------------------------------------

                    rem if [%1] == [] goto help
                    rem if [%2] == [] goto help
                    rem if [%Java_Home%] == [] goto help
                    rem if [%JBoss_Home%] == [] goto help

                    echo on
                    net stop %1

                    JBossService -uninstall %1

                    JBossService -install %1 %Java_Home%\jre\bin\server\jvm.dll -Djava.class.path=%Java_Home%\lib\tools.jar;%JBoss_Home%\bin\run.jar;%JBoss_Home%\bin\shutdown.jar;%JBOSS_HOME%\lib\concurrent.jar;%JBOSS_HOME%\lib\jboss-system.jar -start org.jboss.Main -params -c %2 -stop org.jboss.Shutdown -out %JBoss_Home%\server\%2\log\stdout.log -err %JBoss_Home%\server\%2\log\stderr.log -current %JBoss_Home%\bin

                    @rem JBossService -install %1 %Java_Home%\jre\bin\server\jvm.dll -Djava.class.path=%JAVA_HOME%\lib\tools.jar;%JBOSS_HOME%\bin\run.jar;%JBOSS_HOME%\bin\shutdown.jar -start org.jboss.Main -params -c %2 -stop org.jboss.Shutdown -out %JBoss_Home%\server\%2\log\stdout.log -err %JBoss_Home%\server\%2\log\stderr.log -current %JBoss_Home%\bin

                    @echo off
                    echo The JBoss service can be removed with "JBossService.exe -uninstall %1".
                    goto end

                    echo The environment variables %%Java_Home%% and %%JBoss_Home%% have to be set,
                    echo JBossService.exe and this script have to be in %%JBoss_Home%%\bin.
                    echo Parameters:
                    echo %0 service-name configuration
                    echo service-name: name of service (e.g. "JBoss")
                    echo configuration: configuration of JBoss (e.g. "default", "all" or "minimal")
                    echo Java_Home = %Java_Home%
                    echo JBoss_Home = %JBoss_Home%


                    • 8. Re: How to run JBoss 3.0 as a Windows NT/2K/XP service
                      harlequinn Newbie

                      I solved my problem by not using JavaService at all. I used Java Service Wrapper, SimpleApp mode, and have now got JBOSS 3.2.1 running on three separate win2k machines. Instructions are on Java Service Wrapper homepage.


                      • 9. Re: How to run JBoss 3.0 as a Windows NT/2K/XP service
                        Erik Turesson Novice

                        Could you please post your wrapper.conf file?
                        I have managed to start jboss-jetty 3.2.1 with the instructions on the Java Service Wrapper homepage but I can not compile my jsp pages.

                        I am recieving exceptions when javac is executed.


                        • 10. Re: How to run JBoss 3.0 as a Windows NT/2K/XP service
                          harlequinn Newbie

                          Sure, you might want to check the install forums, people were mentioning same problem here. It was mentioned that this issue is with StartStopApp, so to get rid of it you need to use SimpleApp-type wrapper, which I did. It will still send shutdown signal and JBOSS will still close - I don't get any errors for classpaths and my jsps compile nicely.

                          Here's my wrapper.conf

                          # Wrapper Properties
                          # Java Application

                          # Java Main class


                          # Java Classpath (include wrapper.jar) Add class path elements as
                          # needed starting from 1


                          # Java Library Path (location of Wrapper.DLL or libwrapper.so)

                          # Java Additional Parameters

                          # Initial Java Heap Size (in MB)

                          # Maximum Java Heap Size (in MB)

                          # Application parameters. Add parameters as needed starting from 1


                          # Port which the native wrapper code will attempt to connect to

                          # Wrapper Logging Properties
                          # Format of output for the console. (See docs for formats)

                          # Log Level for console output. (See docs for log levels)

                          # Log file to use for wrapper output logging.

                          # Format of output for the log file. (See docs for formats)

                          # Log Level for log file output. (See docs for log levels)

                          # Maximum size that the log file will be allowed to grow to before
                          # the log is rolled. Size is specified in bytes. The default value
                          # of 0, disables log rolling. May abbreviate with the 'k' (kb) or
                          # 'm' (mb) suffix. For example: 10m = 10 megabytes.

                          # Maximum number of rolled log files which will be allowed before old
                          # files are deleted. The default value of 0 implies no limit.

                          # Log Level for sys/event log output. (See docs for log levels)

                          # Wrapper NT Service Properties
                          # WARNING - Do not modify any of these properties when an application
                          # using this configuration file has been installed as a service.
                          # Please uninstall the service before modifying this section. The
                          # service can then be reinstalled.

                          wrapper.ntservice.displayname=JBoss Application Server
                          wrapper.ntservice.description=JBoss Application Server

                          # Name of the service

                          # Display name of the service

                          # Description of the service

                          # Service dependencies. Add dependencies as needed starting from 1

                          # Mode in which the service is installed. AUTO_START or DEMAND_START

                          # Allow the service to interact with the desktop.

                          • 11. Re: How to run JBoss 3.0 as a Windows NT/2K/XP service
                            Erik Turesson Novice

                            Thank you very much!

                            Your configuration file worked at once.
                            But I do not really understand why because it is almost identical to mine.

                            The difference is that you are using absolute paths, through environment variables, and \.
                            I am using relative paths and / like it is in the Java Service Wrapper example files.


                            • 12. Re: How to run JBoss 3.0 as a Windows NT/2K/XP service
                              tomdee Newbie

                              when you are using relative path, i think
                              the service isn't sure the path is relative to ???

                              we had the same issue with when installing
                              weblogic using relative path. using absolute paths
                              solved our problem.

                              • 13. Re: How to run JBoss 3.0 as a Windows NT/2K/XP service
                                dipaka Newbie

                                Hello everyone,

                                I'm attempting to use JavaService to make an NT Service out of an older version of JBoss, namely JBoss 2.4.4.

                                While I can start the service without issue, stopping the service is causing me no end of grief. Here's the appropriate snippet from my install line (I've added the line breaks for readability):

                                -start org.jboss.Main
                                -params catalina
                                -stop org.jboss.Shutdown

                                Now, the error message I get when stopping is

                                java.lang.NoClassDefFoundError: org/jboss/Shutdown

                                Based on my command-line above, it is because the Shutdown class is in a different classpath, namely %2\lib\ext\jboss.jar;. When I try to use this however, I get all kinds of exceptions on startup.

                                Sadly, all the JavaService docs out there seem to use JBoss 3.0 and above. Has anyone had any luck using JavaService with older JBoss versions?