5 Replies Latest reply on Feb 7, 2011 8:56 AM by Vladimir Valouch

    How to run Servicemix 3.4 as a Windows using prunsrv

    xuguang su Novice

      Hi there,

         I was trying to use Apache Daemon (prunsrv) to install and run Servicemix as a Windows service, but can't get it to start. Has anyone succeeded doing this?


      Thanks for any help!



        • 1. Re: How to run Servicemix 3.4 as a Windows using prunsrv
          Wayne Irwin Newbie

          Here are the steps I followed to get Fuse 4.3 ServiceMix running under Apache Daemon 1.0.3 on Windows XP Pro 2002 SP3.


          Step 1. - Installed Fuse to D:\Fuse-4.3.


          Step 2. - Used these resources for guidance and information http://blog.platinumsolutions.com/node/234  and http://servicemix.apache.org/configure-servicemix-as-a-windows-service.html


          Step 3. -     Downloaded Windows binaries from http://www.apache.org/dist/commons/daemon/binaries/1.0.3/windows/commons-daemon-1.0.3-bin-windows.zip


          Step 4. -     I copied prunsrv.exe and prunmgr.exe to D:\Fuse-4.3\bin and renamed them to FuseSrv.exe and FuseSrvw.exe  (Must both be the same name with the manager adding a ?w? suffix or else when running prunmgr, it will not find the actual service.)


          Step 5. -     At a DOS prompt at D:\Fuse-4.3\bin, I issued command FuseSrv.exe //IS//FuseSrv  --Install=D:\Fuse-4.3\bin\FuseSrv.exe --DisplayName="Fuse" --JvmMx=512 --Startup=auto --Jvm=auto --Classpath=D:\fuse-4.3\lib\karaf-jaas-boot.jar;D:\fuse-4.3\lib\karaf.jar;D:\fuse-4.3\lib\servicemix-version.jar ++JvmOptions=-Djava.util.logging.config.file=D:\fuse-4.3\etc\java.util.logging.properties ++JvmOptions=-Dkaraf.data=D:\fuse-4.3\data ++JvmOptions=-Dkaraf.base=D:\fuse-4.3 ++JvmOptions=-Dkaraf.home=D:\fuse-4.3 ++JvmOptions=-Dkaraf.instances=D:\fuse-4.3\instances ++JvmOptions=-Dcom.sun.management.jmxremote.port=26108;-Dcom.sun.management.jmxremote.password.file=D:\Fuse-4.3\etc\jmxremote.password;-Dcom.sun.management.jmxremote.access.file=D:\Fuse-4.3\etc\jmxremote.access-Dcom.sun.management.jmxremote.ssl=false ++JvmOptions=-Dderby.system.home=D:\fuse-4.3\data\derby ++JvmOptions=-Dkaraf.startLocalConsole=true ++JvmOptions=-Dkaraf.startRemoteShell=true ++JvmOptions=-Djava.endorsed.dirs=D:/fuse-4.3/lib/endorsed ++JvmOptions=-Djava.ext.dirs=D:/fuse-4.3/lib/ext --StartMode=jvm --StartClass=org.apache.karaf.main.Main --StartMethod=main --StartParams=start --StopMode=jvm --StopClass=org.apache.karaf.main.Stop --StopMethod=main --StopParams=stop --LogPath=D:\Fuse-4.3\data\log --LogPrefix=Fuse --StdOutput=auto --StdError=auto --PidFile=FusePid.txt


          Step 6. -     Ran FuseSrvw.exe to confirm the proper options were set. If anything cannot be parsed in the above step, then everything after that point is ignored. Using this tool to check what was set helps to determine where the problem might be.


          Step 7. -     If there are changes to be made, you must delete the installed service with the command FuseSrv.exe //DS//FuseSrv and then repeat Step 5.


          I encountered a problem with Apache Daemon in that I could not put the semicolon character into the ++JvmOptions to set the Java Endorsed and Ext library paths.  When I tried to use the options ++JvmOptions=-Djava.endorsed.dirs=D:/java/lib/endorsed;D:/fuse-4.3/lib/endorsed ++JvmOptions=-Djava.ext.dirs=D:/java/lib/ext;D:/fuse-4.3/lib/ext, the ";" was treated as a parameter separator.  According to Deamon doc (http://commons.apache.org/daemon/procrun.html) , the semicolon can be escaped by enclosing it in single quotes. This failed as the closing quote seems to get lost.  A temporary workaround was not to specify a list of paths and therefore not need the semicolon character in a parameter.


          The only problem I have encountered running Fuse as a service is that it does not shut-down cleanly. During shutdown, I get a "Service is Unavailable".  That also leaves the D:\Fuse-4.3\data\log\FusePid.txt file around.  Restarting the Fuse service will detect the PID file and delete it and then shutdown again.  Restarting it again will be successful.

          • 2. Re: How to run Servicemix 3.4 as a Windows using prunsrv
            xuguang su Novice

            Thank you so much for the information!

            • 3. Re: How to run Servicemix 3.4 as a Windows using prunsrv
              Vladimir Valouch Newbie



              I tried the code above but I bumped into several problems


              1) I'm using ServiceMix/Fuse ESB 4.3.0

              2) jmxremote.password -> file doesn't exist... If I create it then permissions error no matter how long I'm trying to set correct permission in the Windows Server 2003

              3) if I just delete the settings about jmx then the servicemix seems to be running as the service but I'm able to reach it neither via ssh nor local client




              14:37:57,744 | INFO  | NioProcessor-2   | ServerSession                    | shd.server.session.ServerSession   87 | 30 - sshd-core - 0.4.0 | Session created...

              14:37:57,807 | INFO  | NioProcessor-2   | ServerSession                    | shd.server.session.ServerSession  303 | 30 - sshd-core - 0.4.0 | Client version string: SSH-2.0-PuTTY_Release_0.60

              14:37:57,807 | INFO  | NioProcessor-2   | ServerSession                    | shd.server.session.ServerSession  149 | 30 - sshd-core - 0.4.0 | Received SSH_MSG_KEXINIT

              14:37:57,807 | WARN  | NioProcessor-2   | ServerSession                    | d.common.session.AbstractSession  253 | 30 - sshd-core - 0.4.0 | Exception caught

              java.lang.IllegalStateException: Unable to negociate key exchange for item 2

                   at org.apache.sshd.common.session.AbstractSession.negociate(AbstractSession.java:886)[30:sshd-core:0.4.0]

                   at org.apache.sshd.server.session.ServerSession.handleMessage(ServerSession.java:151)[30:sshd-core:0.4.0]

                   at org.apache.sshd.common.session.AbstractSession.decode(AbstractSession.java:522)[30:sshd-core:0.4.0]

                   at org.apache.sshd.common.session.AbstractSession.messageReceived(AbstractSession.java:225)[30:sshd-core:0.4.0]

                   at org.apache.sshd.common.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:58)[30:sshd-core:0.4.0]

                   at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:713)[25:org.apache.mina.core:2.0.0.RC1]

                   at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)[25:org.apache.mina.core:2.0.0.RC1]

                   at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)[25:org.apache.mina.core:2.0.0.RC1]

                   at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)[25:org.apache.mina.core:2.0.0.RC1]

                   at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)[25:org.apache.mina.core:2.0.0.RC1]

                   at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)[25:org.apache.mina.core:2.0.0.RC1]

                   at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)[25:org.apache.mina.core:2.0.0.RC1]

                   at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:638)[25:org.apache.mina.core:2.0.0.RC1]

                   at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:598)[25:org.apache.mina.core:2.0.0.RC1]

                   at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:587)[25:org.apache.mina.core:2.0.0.RC1]

                   at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:61)[25:org.apache.mina.core:2.0.0.RC1]

                   at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:969)[25:org.apache.mina.core:2.0.0.RC1]

                   at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)[25:org.apache.mina.core:2.0.0.RC1]

                   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)[:1.6.0_22]

                   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)[:1.6.0_22]

                   at java.lang.Thread.run(Unknown Source)[:1.6.0_22]

              14:37:57,807 | INFO  | NioProcessor-2   | ServerSession                    | d.common.session.AbstractSession  287 | 30 - sshd-core - 0.4.0 | Closing session


              Edited by: vvalouch on Feb 7, 2011 12:41 PM

              • 4. Re: How to run Servicemix 3.4 as a Windows using prunsrv
                Gert Vanthienen Novice




                Are you sure the SSH console works if you just run the container from a plain command line?  To me, that exception looks more like problem with available crypto providers, so it would be nice to know if that's something system-specific or something missing in the commons daemon configuration.


                Also, I think you should use -Dkaraf.startLocalConsole=false to avoid starting a console that tries to read information from System.in from a background service.  You can still access the console over ssh from the local machine.


                And finally, for the JMX bits, how about if you just copy the setting you find in bin/karaf or bin/servicemix instead of setting up a new JMX environment?






                • 5. Re: How to run Servicemix 3.4 as a Windows using prunsrv
                  Vladimir Valouch Newbie



                  thanks for quick response. I will try to describe the situation in a bit better way:

                  - when i start the servicemix through servicemix.bat(not a windows service) then there is no problem to run putty and get to the console

                  - if I start the window service I cannot get running neither local client nor ssh





                  here you can see the command which I'm using to create a window service from servicemix:


                  FuseSrv.exe //IS//FuseSrv --Install=%servicemix_home%\bin\FuseSrv.exe --DisplayName="Fuse" --JvmMx=512 --Startup=auto --Jvm=auto --Classpath=%servicemix_home%\lib\karaf-jaas-boot.jar;%servicemix_home%\lib\karaf.jar;%servicemix_home%\lib\servicemix-version.jar ++JvmOptions=-Djava.util.logging.config.file=%servicemix_home%\etc\java.util.logging.properties ++JvmOptions=-Dkaraf.data=%servicemix_home%\data ++JvmOptions=-Dkaraf.base=%servicemix_home% ++JvmOptions=-Dkaraf.home=%servicemix_home% ++JvmOptions=-Dkaraf.instances=%servicemix_home%\instances  ++JvmOptions=-Dderby.system.home=%servicemix_home%\data\derby ++JvmOptions=-Dkaraf.startLocalConsole=false ++JvmOptions=-Dkaraf.startRemoteShell=true ++JvmOptions=-Djava.endorsed.dirs=%servicemix_home%/lib/endorsed ++JvmOptions=-Djava.ext.dirs=%servicemix_home%/lib/ext --StartMode=jvm --StartClass=org.apache.karaf.main.Main --StartMethod=main --StartParams=start --StopMode=jvm --StopClass=org.apache.karaf.main.Stop --StopMethod=main --StopParams=stop --LogPath=%servicemix_home%\data\log --LogPrefix=Fuse --StdOutput=auto --StdError=auto --PidFile=FusePid.txt