1 2 3 Previous Next 31 Replies Latest reply on Sep 6, 2002 10:04 AM by cosmotic

    JBoss+Tomcat Running as a Service

    nightowl

      Is there a way to run the JBoss+Tomcat installation on Windows 2000 as a Service? Currently, I must manually login to an account and start it on the command line.

      SY

        • 1. Re: JBoss+Tomcat Running as a Service
          lsanders

          I do this using the cygwin tools (www.cygwin.com). These are a set of standard unix tools that run on Windows. They include a suite of windows administrative tools, including cygrunsrv.

          Once installed, you can create a service from a cygwin prompt like this:

          cygrunsrv -I JBoss -p /cygdrive/c/jboss/bin/run.bat

          -Larry

          > Is there a way to run the JBoss+Tomcat installation
          > on Windows 2000 as a Service? Currently, I must
          > manually login to an account and start it on the
          > command line.
          >
          > SY

          • 2. Re: JBoss+Tomcat Running as a Service

            There is an nt service contribution in JBoss's CVS

            http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/contrib/ntservice

            or download all the plugins at

            http://www.jboss.org/developers/cvs.jsp

            BUT this looks to be far from complete.

            It more like somebody just dropped the javants
            distribution into cvs without doing any
            configuration for JBoss :-(

            Regards,
            Adrian

            • 3. Re: JBoss+Tomcat Running as a Service
              yalmasri

              Hello Larry,

              I tried to get Tomcat to run as service using this way; the service was installed successfully, but it couldn't start. I guess the problem is from the path option (-p), which look weird to me somewhat. Did you do any special steps other than typing this line? For tomcat installation, I typed this:
              cygrunsrv --install Tomcat --path D:\jakarta-project\tomcat\bin\startup.bat
              I don't know if that was correct, can you please help me?

              Thanx

              • 4. Re: JBoss+Tomcat Running as a Service

                Nearly correctly.

                Don't forget cygwin is a unix tools port so it
                uses / instead of \
                Also it uses /cygdrive/d instead of d:

                So you should have

                --path /cygdrive/d/jakarta-project/tomcat/bin/startup.bat

                Regards,
                Adrian

                • 5. Re: JBoss+Tomcat Running as a Service
                  yalmasri

                  Thanks Adrian, that was the problem.

                  • 6. Re: JBoss+Tomcat Running as a Service
                    yalmasri

                    Oops! It sounds that I ran into trouble again.

                    Tomcat alone started just fine as a service, but I don't know what happened when I tried to start JBoss the same way, here's what I did:

                    I typed this on my command shell:

                    cygrunsrv --install JBoss --path /cygdrive/d/JBoss-2.2.2_Tomcat-3.2.2/jboss/bin/run_with_tomcat.bat

                    "run_with_tomcat.bat" has the following script:

                    @echo off
                    set JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;%JAVA_HOME%/lib/tools.jar
                    .\run.bat tomcat

                    "run.bat" exists in the same directory and look like this:

                    @echo off
                    @if not "%ECHO%" == "" echo %ECHO%
                    @if "%OS%" == "Windows_NT" setlocal
                    set JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;run.jar
                    set JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;../lib/xerces_1_4_0.jar
                    set JAXP=-
                    Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
                    set JAXP=%JAXP% -
                    Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
                    java %JAXP% -classpath "%JBOSS_CLASSPATH%" org.jboss.Main %1 %2 %3 %4 %5 %6 %7 %8 %9

                    The service was installed successfully, but when I tried to start it using:

                    cygrunsrv --start JBoss

                    I got this error:
                    cygrunsrv: Error starting a service: QueryServiceStatus: Win32 error 1062: The service has not been started.

                    I'd be grateful if anybody can help me in this, I really am in need to run it as service.

                    • 7. Re: JBoss+Tomcat Running as a Service

                      Have you looked in JBOSS_HOME/log/server.log?

                      Did you remember to stop Tomcat before starting
                      JBoss/Tomcat?

                      Regards,
                      Adrian

                      • 8. Re: JBoss+Tomcat Running as a Service

                        Also, the fact that the batch program does not
                        return may be confusing windows.

                        Try changing the line beginning
                        .\run.bat

                        to
                        start .\run.bat

                        I can't give you much more help, I haven't tried doing
                        this myself.

                        Regards,
                        Adrian

                        • 9. Re: JBoss+Tomcat Running as a Service
                          bytor2002

                          Someone posted a response about this. There is a tool that allows any Java application to run as a service. Here is the link to the home page. Disclaimer: I have not tried this myself (yet).

                          http://www.eworksmart.com/JNT/

                          -Michael Schulz

                          • 10. Re: JBoss+Tomcat Running as a Service
                            jdelozier

                            *********************************
                            ***** The Problem Explained *****

                            I tried the JNT Service Wrapper and it works great ... for a second (if that long). Let me explain. First, I created the service with the following command:

                            jnt "/InstallAsService:JBoss Catalina" "/SDp:\JBoss-2.4.4_Tomcat-4.0.1\jboss\bin" -classpath".;%JAVA_HOME%\lib\tools.jar;run.jar;..\lib\crimson.jar" -Dshutdown.method=org.jboss.Shutdown.main -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson.jaxp.DocumentBuilderFactoryImpl -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactoryImpl org.jboss.Main catalina

                            It installed the service w/o a hitch. I started the service, great so far. Opened a browser and tried http://localhost:8080/jboss and ... "Page could not be found"

                            I checked the log file the JNT Wrapper created for errors and found none. However, the log file did record a shutdown process.

                            I think what is happening is the service is running org.jboss.Main correctly, returning from Main and stopping.

                            Also, the "shut down gracefully" feature of JNT Wrapper requires the shutdown method to reside within the initial start class (ie org.jboss.Main). The default source code does have a shutdown method, but it resides within it own class, namely org.jboss.Shutdown.

                            ************************************
                            ***** What I think is occuring *****

                            When JBoss starts, it runs in the "Command Prompt" process. When you close the command prompt, it destroys that process, thus shutting down JBoss. In other words, JBoss is alive, as long as it's pocess ("Command Prompt") is still alive.

                            However, when you run JBoss as a JNT Service, it resides within it's own process. Therefore, when it returns from Main, it desroys it's own thread.

                            ****************************************
                            ***** What I think is the solution *****

                            If this is true, then to fix the problem, instead of returning from Main, it needs to initate a listener and wait for a shutdown command. Then return from main, and thus shutdown.

                            **********************
                            ***** Conclusion *****

                            Am I right, or wrong, or what? Any thought at all ...

                            • 11. Re: JBoss+Tomcat Running as a Service
                              livejavabean

                              man i spent 3 hours finally find a doc has this info...
                              no JNT no cygwin no nothing except javants.exe. dang this file is being used by jboss developer whey they don't share this?
                              wat da.

                              hope it helps u dude:
                              http://www.hta-bi.bfh.ch/Projects/aaps/docbook_html/x794.html

                              beware with those PATH

                              • 12. Re: JBoss+Tomcat Running as a Service
                                guy_rouillier

                                javants had a bug in it. I found it and fixed it. See bug 530166 in the sourceforge jboss section. With this fix, javants works well. I'm using it for both JBoss and Tomcat running separately. I also have sample properties files for each if anyone is interested.

                                • 13. Re: JBoss+Tomcat Running as a Service
                                  mheidimcclure

                                  I hope you are listening guy_rouillier...

                                  I would like copies of your properties files, but your email bounced back at me with @home.com as an unknown host.

                                  thank you,
                                  -heidi

                                  heidi@iswsolutions.com

                                  • 14. Re: JBoss+Tomcat Running as a Service
                                    guy_rouillier

                                    I can't figure out how to change my email address. That one has expired. I'm sending you the properties files.

                                    1 2 3 Previous Next