Thanks Dejan, your information about the authentication parameters helped,
however I couldn't get around the "Port already in use" error by simply
moving the SUNJMX variable definition.  Here's what I ended up doing that
fixed the issue completely:

I added the following to bin/activemq-admin script:
case $@ in
   sta*) ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $SUNJMX $SSL_OPTS" ;;
   *) ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS $SSL_OPTS" ;;
esac

Now it won't try to instantiate JMX when it's trying to stop or query the
broker.

M@


Dejan Bosanac wrote:
> 
> The problem is that activemq-admin gets configuration from
> /etc/activemq.conf if it is available. Can you try putting your SUNJMX in
> bin/activemq and see what happens?
> As for the run.jar, you have to pass your JMX username and password with
> --jmxuser and --jmxpassword switches.
> 
> Cheers
> --
> Dejan Bosanac
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 
> 
> On Tue, Jan 6, 2009 at 4:20 AM, MaenXe <m...@docmagic.com> wrote:
> 
>>
>> I recently tried to password protect the JMX Connector using the
>> instructions
>> here:
>> http://activemq.apache.org/jmx.html#JMX-PasswordProtectingtheJMXConnector
>>
>> Now when I try to stop the broker using "activemq-admin stop" I get the
>> following error:
>>
>> Error: Exception thrown by the agent : java.rmi.server.ExportException:
>> Port
>> already in use: 1099; nested exception is:
>>        java.net.BindException: Address already in use
>>
>> If I try to stop the broker using "java -jar run.jar stop", I get:
>>
>> ERROR: java.lang.RuntimeException: Failed to execute stop task. Reason:
>> java.lang.SecurityException: Authentication failed! Credentials required
>> java.lang.RuntimeException: Failed to execute stop task. Reason:
>> java.lang.SecurityException: Authentication failed! Credentials required
>>        at
>>
>> org.apache.activemq.console.command.ShutdownCommand.runTask(ShutdownCommand.java:106)
>>        at
>>
>> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>>        at
>>
>> org.apache.activemq.console.command.AbstractJmxCommand.execute(AbstractJmxCommand.java:224)
>>        at
>>
>> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:129)
>>        at
>>
>> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>>        at
>> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:79)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:585)
>>        at org.apache.activemq.console.Main.runTaskClass(Main.java:225)
>>        at org.apache.activemq.console.Main.main(Main.java:106)
>> ERROR: java.lang.Exception: java.lang.SecurityException: Authentication
>> failed! Credentials required
>> java.lang.Exception: java.lang.SecurityException: Authentication failed!
>> Credentials required
>>        at
>>
>> org.apache.activemq.console.command.ShutdownCommand.runTask(ShutdownCommand.java:107)
>>        at
>>
>> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>>        at
>>
>> org.apache.activemq.console.command.AbstractJmxCommand.execute(AbstractJmxCommand.java:224)
>>        at
>>
>> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:129)
>>        at
>>
>> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>>        at
>> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:79)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:585)
>>        at org.apache.activemq.console.Main.runTaskClass(Main.java:225)
>>        at org.apache.activemq.console.Main.main(Main.java:106)
>> Caused by: java.lang.SecurityException: Authentication failed!
>> Credentials
>> required
>>        at
>>
>> com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticationFailure(JMXPluggableAuthenticator.java:193)
>>        at
>>
>> com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticate(JMXPluggableAuthenticator.java:145)
>>        at
>>
>> sun.management.jmxremote.ConnectorBootstrap$AccessFileCheckerAuthenticator.authenticate(ConnectorBootstrap.java:182)
>>        at
>>
>> javax.management.remote.rmi.RMIServerImpl.doNewClient(RMIServerImpl.java:212)
>>        at
>> javax.management.remote.rmi.RMIServerImpl.newClient(RMIServerImpl.java:179)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:585)
>>        at
>> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
>>        at sun.rmi.transport.Transport$1.run(Transport.java:153)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
>>        at
>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
>>        at
>>
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
>>        at java.lang.Thread.run(Thread.java:595)
>>        at
>>
>> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
>>        at
>> sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
>>        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
>>        at
>> javax.management.remote.rmi.RMIServerImpl_Stub.newClient(Unknown
>> Source)
>>        at
>>
>> javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2239)
>>        at
>> javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:271)
>>        at
>>
>> javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
>>        at
>>
>> javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:207)
>>        at
>>
>> org.apache.activemq.console.command.AbstractJmxCommand.createJmxConnector(AbstractJmxCommand.java:146)
>>        at
>>
>> org.apache.activemq.console.command.AbstractJmxCommand.createJmxConnection(AbstractJmxCommand.java:169)
>>        at
>>
>> org.apache.activemq.console.command.ShutdownCommand.runTask(ShutdownCommand.java:70)
>>        ... 11 more
>>
>> I'm specifying the SUNJMX options through /etc/activemq.conf.  They are
>> as
>> follows:
>>
>> SUNJMX="-Dcom.sun.management.jmxremote.port=1099
>> -Dcom.sun.management.jmxremote.ssl=false
>> -Dcom.sun.management.jmxremote.authenticate=true
>>
>> -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_BASE}/conf/jmx.password
>>
>> -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_BASE}/conf/jmx.access"
>>
>> Per the instructions, I am not creating a JMX connector thru the
>> activemq.xml config file.  Also I'm noticing that the JMX Connector is
>> not
>> running on port 1099, netstat shows it running on a different port each
>> time
>> I start the broker.
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Unable-to-Stop-ActiveMQ-Broker-from-activemq-admin-script-tp21304038p21304038.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> Dejan Bosanac
> 
> 
> http://www.ttmsolutions.com - get a free ActiveMQ user guide
> 
> ActiveMQ in Action - http://www.manning.com/snyder/
> Scripting in Java - http://www.scriptinginjava.net
> 

-- 
View this message in context: 
http://www.nabble.com/Unable-to-Stop-ActiveMQ-Broker-from-activemq-admin-script-tp21304038p21323627.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to