I thought I had created a JIRA for this, but I have a similar issue. :)
At Yahoo!, we use jsvc to start/stop things, and as such I've implements the
Commons Daemon interface for starting and stopping ActiveMQ. I am waiting for
approval to contribute the wrapper code, and start/stop scripts for RHEL, and
this should tie in nicely with the windows work you have done.
I created a JIRA for this: https://issues.apache.org/activemq/browse/AMQ-2968,
as I am just waiting approval for the Java code Yahoo! Has created, and it
looks like you have the windows side done, all that is left is the shell
scripts for start/stop on Linux.
--Allen
-----Original Message-----
From: Pitre, Russell [mailto:rpi...@shawmut.com]
Sent: Friday, October 08, 2010 6:05 AM
To: users@activemq.apache.org
Subject: Service Wrapper on Windows Server 2008 R2
I recently wrote a blog article about using Commons Daemon Procrun as a service
wrapper for ActiveMQ running on Windows server 2008 R2 64-bit.
Passing the link along for anyone who may find it useful. I searched for
alternative 64-bit compatible service wrappers on windows systems and didn't
come up with any solutions that I found would make it easy to manage and
configure the windows service, so I gave Procrun a shot, I figured if Tomcat
ships with it, why not try it out with ActiveMQ.
Let me know if you see any errors or gotchas.
http://blog.bigrocksoftware.com/2010/10/07/commons-daemon-procrun-as-a-j
ava-service-wrapper-for-activemq/
Thanks
-Russ
--- Begin Message ---
JSVC looks interesting, it could be nice addition/improvement of the
current scripts.
Of course, all contributions are welcomed :)
Cheers
--
Dejan Bosanac - http://twitter.com/dejanb
Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net
On Wed, Sep 29, 2010 at 7:22 PM, Allen Reese <are...@yahoo-inc.com> wrote:
> Have you guys considered using something like apache jsvc to stop and start?
> http://commons.apache.org/daemon/jsvc.html
>
> It's much cleaner and doesn't require jmx to start and stop. All that needs
> to be done is to write a simple wrapper to implement the Daemon interface,
> and implement start and stop.
>
> This is what I'm using to start and stop activemq instead of the start/stop
> scripts as we need to drop privileges when the application is started which
> jsvc does.
>
> Jsvc is supposed to work on windows (I've never monkeyed with anything but
> RHEL). It starts and stops much cleaner for my use cases.
>
> --Allen
>
> -----Original Message-----
> From: chubr...@gmail.com [mailto:chubr...@gmail.com] On Behalf Of Dejan
> Bosanac
> Sent: Wednesday, September 29, 2010 1:17 AM
> To: users@activemq.apache.org
> Subject: Re: exception trying to stop activemq, stomp weirdness
>
> Hi,
>
> the stop script tries first to connect to the broker using JMX and stop it
> "cleanly" and if it doesn't succeed it kills it. So make sure you enable it
> in your activemq.xml
>
>
> Cheers
> --
> Dejan Bosanac - http://twitter.com/dejanb
>
> Open Source Integration - http://fusesource.com/ ActiveMQ in Action -
> http://www.manning.com/snyder/ Blog - http://www.nighttale.net
>
>
>
> On Tue, Sep 28, 2010 at 10:26 PM, rrwoods <rwo...@tresys.com> wrote:
>>
>> I'm on Red Hat Enterprise Linux 5, in case that matters. ActiveMQ
>> 5.4.0 is installed to /usr/local/activemq, and a user named 'activemq'
>> owns this directory and everything in it (via `chown -R activemq
>> /usr/local/activemq`). The behavior described here happens when I
>> take the actions described either as 'root' or as 'activemq'.
>>
>> If I say `activemq start`, I get a java process running and `netstat
>> -a` shows port 61616 being used. `activemq stop` throws a Java
>> exception, then terminates ActiveMQ with SIGKILL:
>>
>> $ bin/activemq stop
>> INFO: Using default configuration
>> (you can configure options in one of these file: /etc/default/activemq
>> /home/activemq/.activemqrc)
>>
>> INFO: Invoke the following command to create a configuration file
>> bin/activemq setup [ /etc/default/activemq |
>> /home/activemq/.activemqrc ]
>>
>> INFO: Using java '/usr/bin/java'
>> INFO: Waiting at least 30 seconds for regular process termination of
>> pid '6206' : Java Runtime: Sun Microsystems Inc. 1.6.0_21
>> /usr/java/jre1.6.0_21
>> Heap sizes: current=15552k free=15146k max=249472k
>> JVM args: -Dactivemq.classpath=/usr/local/activemq/conf;
>> -Dactivemq.home=/usr/local/activemq
>> -Dactivemq.base=/usr/local/activemq
>> ACTIVEMQ_HOME: /usr/local/activemq
>> ACTIVEMQ_BASE: /usr/local/activemq
>> Connecting to JMX URL:
>> service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
>> ERROR: java.lang.RuntimeException: Failed to execute stop task. Reason:
>> java.io.IOException: Failed to retrieve RMIServer stub:
>> javax.naming.ServiceUnavailableException [Root exception is
>> java.rmi.ConnectException: Connection refused to host: localhost;
>> nested exception is:
>> java.net.ConnectException: Connection refused]
>> java.lang.RuntimeException: Failed to execute stop task. Reason:
>> java.io.IOException: Failed to retrieve RMIServer stub:
>> javax.naming.ServiceUnavailableException [Root exception is
>> java.rmi.ConnectException: Connection refused to host: localhost;
>> nested exception is:
>> java.net.ConnectException: Connection refused]
>> at
>> org.apache.activemq.console.command.ShutdownCommand.runTask(ShutdownCo
>> mmand.java:106)
>> at
>> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCo
>> mmand.java:57)
>> at
>> org.apache.activemq.console.command.AbstractJmxCommand.execute(Abstrac
>> tJmxCommand.java:292)
>> at
>> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.
>> java:137)
>> at
>> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCo
>> mmand.java:57)
>> at
>> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.jav
>> a:83)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>> Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at org.apache.activemq.console.Main.runTaskClass(Main.java:251)
>> at org.apache.activemq.console.Main.main(Main.java:107)
>> ERROR: java.lang.Exception: java.io.IOException: Failed to retrieve
>> RMIServer stub: javax.naming.ServiceUnavailableException [Root
>> exception is
>> java.rmi.ConnectException: Connection refused to host: localhost;
>> nested exception is:
>> java.net.ConnectException: Connection refused]
>> java.lang.Exception: java.io.IOException: Failed to retrieve RMIServer stub:
>> javax.naming.ServiceUnavailableException [Root exception is
>> java.rmi.ConnectException: Connection refused to host: localhost;
>> nested exception is:
>> java.net.ConnectException: Connection refused]
>> at
>> org.apache.activemq.console.command.ShutdownCommand.runTask(ShutdownCo
>> mmand.java:107)
>> at
>> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCo
>> mmand.java:57)
>> at
>> org.apache.activemq.console.command.AbstractJmxCommand.execute(Abstrac
>> tJmxCommand.java:292)
>> at
>> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.
>> java:137)
>> at
>> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCo
>> mmand.java:57)
>> at
>> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.jav
>> a:83)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>> Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at org.apache.activemq.console.Main.runTaskClass(Main.java:251)
>> at org.apache.activemq.console.Main.main(Main.java:107)
>> Caused by: java.io.IOException: Failed to retrieve RMIServer stub:
>> javax.naming.ServiceUnavailableException [Root exception is
>> java.rmi.ConnectException: Connection refused to host: localhost;
>> nested exception is:
>> java.net.ConnectException: Connection refused]
>> at javax.management.remote.rmi.RMIConnector.connect(Unknown
>> Source)
>> at javax.management.remote.JMXConnectorFactory.connect(Unknown
>> Source)
>> at javax.management.remote.JMXConnectorFactory.connect(Unknown
>> Source)
>> at
>> org.apache.activemq.console.command.AbstractJmxCommand.createJmxConnec
>> tor(AbstractJmxCommand.java:214)
>> at
>> org.apache.activemq.console.command.AbstractJmxCommand.createJmxConnec
>> tion(AbstractJmxCommand.java:237)
>> at
>> org.apache.activemq.console.command.ShutdownCommand.runTask(ShutdownCo
>> mmand.java:70)
>> ... 11 more
>> Caused by: javax.naming.ServiceUnavailableException [Root exception is
>> java.rmi.ConnectException: Connection refused to host: localhost;
>> nested exception is:
>> java.net.ConnectException: Connection refused]
>> at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown
>> Source)
>> at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown
>> Source)
>> at javax.naming.InitialContext.lookup(Unknown Source)
>> at
>> javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(Unknown
>> Source)
>> at
>> javax.management.remote.rmi.RMIConnector.findRMIServer(Unknown
>> Source)
>> ... 17 more
>> Caused by: java.rmi.ConnectException: Connection refused to host:
>> localhost; nested exception is:
>> java.net.ConnectException: Connection refused
>> at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
>> at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown
>> Source)
>> at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown
>> Source)
>> at sun.rmi.server.UnicastRef.newCall(Unknown Source)
>> at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
>> ... 22 more
>> Caused by: java.net.ConnectException: Connection refused
>> at java.net.PlainSocketImpl.socketConnect(Native Method)
>> at java.net.PlainSocketImpl.doConnect(Unknown Source)
>> at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>> at java.net.PlainSocketImpl.connect(Unknown Source)
>> at java.net.SocksSocketImpl.connect(Unknown Source)
>> at java.net.Socket.connect(Unknown Source)
>> at java.net.Socket.connect(Unknown Source)
>> at java.net.Socket.<init>(Unknown Source)
>> at java.net.Socket.<init>(Unknown Source)
>> at
>> sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown
>> Source)
>> at
>> sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown
>> Source)
>> ... 27 more
>> ..............................
>> INFO: Regular shutdown not successful, sending SIGKILL to process
>> with pid '6206'
>>
>> This is acceptable, but obviously less than desirable. What might be
>> causing this?
>> --
>> View this message in context:
>> http://activemq.2283324.n4.nabble.com/exception-trying-to-stop-activem
>> q-stomp-weirdness-tp2717869p2717869.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>
--- End Message ---