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.

      HTH

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

          Notes:

          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
              dahan

              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
                soeiro

                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.

                Regards,

                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

                    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.
                    echo Installing JBoss as service on Windows NT/2K/XP
                    echo -----------------------------------------------
                    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.
                    echo.
                    echo The JBoss service can be removed with "JBossService.exe -uninstall %1".
                    goto end

                    :help
                    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.
                    echo Parameters:
                    echo %0 service-name configuration
                    echo.
                    echo service-name: name of service (e.g. "JBoss")
                    echo configuration: configuration of JBoss (e.g. "default", "all" or "minimal")
                    echo.
                    echo Java_Home = %Java_Home%
                    echo JBoss_Home = %JBoss_Home%
                    echo.

                    :end

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

                      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.

                      http://wrapper.tanukisoftware.org/doc/english/index.html

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

                        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.

                        /Erik

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

                          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
                          wrapper.java.command=%JAVA_HOME%\bin\java

                          # Java Main class
                          #wrapper.java.mainclass=org.tanukisoftware.wrapper.test.Main

                          wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

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

                          wrapper.java.classpath.1=%JBOSS_HOME%\lib\wrapper.jar
                          wrapper.java.classpath.2=%JAVA_HOME%\lib\tools.jar
                          wrapper.java.classpath.3=%JBOSS_HOME%\bin\run.jar


                          # Java Library Path (location of Wrapper.DLL or libwrapper.so)
                          wrapper.java.library.path.1=%JBOSS_HOME%\lib


                          # Java Additional Parameters
                          #wrapper.java.additional.1=
                          wrapper.java.additional.1=-Dprogram.name=run.bat


                          # Initial Java Heap Size (in MB)
                          wrapper.java.initmemory=64

                          # Maximum Java Heap Size (in MB)
                          wrapper.java.maxmemory=128

                          # Application parameters. Add parameters as needed starting from 1
                          #wrapper.app.parameter.1=

                          wrapper.app.parameter.1=org.jboss.Main
                          wrapper.app.parameter.2=-c
                          wrapper.app.parameter.3=default


                          # Port which the native wrapper code will attempt to connect to
                          wrapper.port=1777

                          #********************************************************************
                          # Wrapper Logging Properties
                          #********************************************************************
                          # Format of output for the console. (See docs for formats)
                          wrapper.console.format=PM

                          # Log Level for console output. (See docs for log levels)
                          wrapper.console.loglevel=INFO

                          # Log file to use for wrapper output logging.
                          wrapper.logfile=../logs/wrapper.log

                          # Format of output for the log file. (See docs for formats)
                          wrapper.logfile.format=LPTM

                          # Log Level for log file output. (See docs for log levels)
                          wrapper.logfile.loglevel=INFO

                          # 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.
                          wrapper.logfile.maxsize=0

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

                          # Log Level for sys/event log output. (See docs for log levels)
                          wrapper.syslog.loglevel=NONE

                          #********************************************************************
                          # 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.name=JBossWrapper
                          wrapper.ntservice.displayname=JBoss Application Server
                          wrapper.ntservice.description=JBoss Application Server


                          # Name of the service
                          #wrapper.ntservice.name=@app.name@

                          # Display name of the service
                          #wrapper.ntservice.displayname=@app.long.name@

                          # Description of the service
                          #wrapper.ntservice.description=@app.description@

                          # Service dependencies. Add dependencies as needed starting from 1
                          #wrapper.ntservice.dependency.1=

                          # Mode in which the service is installed. AUTO_START or DEMAND_START
                          wrapper.ntservice.starttype=AUTO_START

                          # Allow the service to interact with the desktop.
                          wrapper.ntservice.interactive=false

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

                            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.

                            /Erik

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

                              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

                                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):

                                %1\jre\bin\%3\jvm.dll
                                -Djava.class.path=%1\lib\tools.jar;%2\bin\run.jar;
                                -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?