SpringSource/spring-net-amqp — Issue #21: Using RabbitBrokerAdmin from Windows service
Author: simoneb
Created: 2012-01-09 23:58:27+00:00
State: open

Hi, I am having some issues trying to use the class RabbitBrokerAdmin from within a Windows service. When running as my main Windows user (as well as if the Windows service runs with my user credentials) everything is running fine. If instead I try to run the service as Local System or another user account something does not work as expected.
I haven't figured out the correlation about my current user, which works, and another user, which doesn't, except that the first is the one logged into the machine, while the other isn't.

So what I'm experiencing after using the method StartBrokerApplication, which in turn shells out the rabbitmq-server.bat is this on the output of the application:

>Spring.Messaging.Amqp.Rabbit.Admin.RabbitAdminAuthException: Could not authorise connection to Erlang process. This >can happen if the broker is running, but as root or rabbitmq and the current user is not authorised to connect. Try starting the >broker again as a different user. ---> Erlang.NET.OtpAuthException: Peer authentication error.
> at Erlang.NET.AbstractConnection.doConnect(Int32 port)
> at Erlang.NET.AbstractConnection..ctor(OtpLocalNode self, OtpPeer other)
> at Erlang.NET.OtpSelf.connect(OtpPeer other)
> at Spring.Erlang.Connection.SimpleConnectionFactory.CreateConnection() in e:\Dev\spring-net-amqp\src\Spring.Erlang\Connection\SimpleConnectionFactory.cs:line 123
> at Spring.Erlang.Support.ErlangAccessor.CreateConnection() in e:\Dev\spring-net-amqp\src\Spring.Erlang\Support\ErlangAccessor.cs:line 73
> at Spring.Erlang.Core.ErlangTemplate.Execute[T](ConnectionCallbackDelegate`1 action) in e:\Dev\spring-net-amqp\src\Spring.Erlang\Core\ErlangTemplate.cs:line 213
> at Spring.Erlang.Core.ErlangTemplate.ExecuteErlangRpc(String module, String function, OtpErlangList args) in e:\Dev\spring-net-amqp\src\Spring.Erlang\Core\ErlangTemplate.cs:line 73
> at Spring.Erlang.Core.ErlangTemplate.ExecuteAndConvertRpc(String module, String function, Object[] args) in e:\Dev\spring-net-amqp\src\Spring.Erlang\Core\ErlangTemplate.cs:line 179
> at Spring.Messaging.Amqp.Rabbit.Admin.RabbitBrokerAdmin.ExecuteAndConvertRpc[T](String module, String function, Object[] args) in e:\Dev\spring-net-amqp\src\Spring.Messaging.Amqp.Rabbit.Admin\Admin\RabbitBrokerAdmin.cs:line 1018
> at Spring.Messaging.Amqp.Rabbit.Admin.RabbitBrokerAdmin.GetStatus() in e:\Dev\spring-net-amqp\src\Spring.Messaging.Amqp.Rabbit.Admin\Admin\RabbitBrokerAdmin.cs:line 931
> --- End of inner exception stack trace ---
> at Spring.Messaging.Amqp.Rabbit.Admin.RabbitBrokerAdmin.GetStatus() in e:\Dev\spring-net-amqp\src\Spring.Messaging.Amqp.Rabbit.Admin\Admin\RabbitBrokerAdmin.cs:line 959
> at Spring.Messaging.Amqp.Rabbit.Admin.RabbitBrokerAdmin.WaitForState(Func`2 callable, String state) in e:\Dev\spring-net-amqp\src\Spring.Messaging.Amqp.Rabbit.Admin\Admin\RabbitBrokerAdmin.cs:line 750
> at Spring.Messaging.Amqp.Rabbit.Admin.RabbitBrokerAdmin.WaitForReadyState() in e:\Dev\spring-net-amqp\src\Spring.Messaging.Amqp.Rabbit.Admin\Admin\RabbitBrokerAdmin.cs:line 716
> at Spring.Messaging.Amqp.Rabbit.Admin.RabbitBrokerAdmin.StartNode() in e:\Dev\spring-net-amqp\src\Spring.Messaging.Amqp.Rabbit.Admin\Admin\RabbitBrokerAdmin.cs:line 706
> at Spring.Messaging.Amqp.Rabbit.Admin.RabbitBrokerAdmin.StartBrokerApplication() in e:\Dev\spring-net-amqp\src\Spring.Messaging.Amqp.Rabbit.Admin\Admin\RabbitBrokerAdmin.cs:line 470

While in the broker logs I see this:

=ERROR REPORT==== 10-Jan-2012::00:47:11 ===
** Connection attempt from disallowed node 'rabbit-spring-monitor-a8705693-b341-4fa6-9d16-ff06990ee537@[my host name here]' **

I tried several combinations of node name / cookie, but I can't seem to get it to work.