You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by pwalter <pa...@nasa.gov> on 2014/06/05 19:55:35 UTC

ActiveMQ NMS Fails when User/Password Required

ActiveMQ NMS fails when User/Password is required. ActiveMQ with JAVA works
with same URL/user/pwd.

                Uri connecturi = new Uri(url);
                IConnectionFactory factory = new
Apache.NMS.ActiveMQ.ConnectionFactory(connecturi);

                connection = factory.CreateConnection(user, password);
                connection.Start();

Error: Apache.NMS.ActiveMQ.ConnectionClosedException: The connection is
already closed!

Any Ideas ??
THANKS FOR YOUR QUICK RESPONSE!!!



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-NMS-Fails-when-User-Password-Required-tp4681728.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ NMS Fails when User/Password Required

Posted by Jim Gomes <jg...@apache.org>.
I use the following template and use variable replacement at runtime:

${appname}-${hostname}-${guid}

This way I can look in the connections list in the ActiveMQ broker console
and know where the connection came from, but it gets a unique ID so that
more than one instance of the app on the same machine will show up as a
distinct connection.



On Thu, Jun 5, 2014 at 12:02 PM, pwalter <pa...@nasa.gov> wrote:

> Jim,
> Thanks...
> What do you use for the connectionID? Will null work?
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-NMS-Fails-when-User-Password-Required-tp4681728p4681735.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: ActiveMQ NMS Fails when User/Password Required

Posted by pwalter <pa...@nasa.gov>.
Jim,
Thanks...
What do you use for the connectionID? Will null work?




--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-NMS-Fails-when-User-Password-Required-tp4681728p4681735.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: ActiveMQ NMS Fails when User/Password Required

Posted by Jim Gomes <jg...@apache.org>.
This code works, and it is used frequently.  Following is a snippet from my
own code.  I recommend staying at the generic NMS API level, and not using
ActiveMQ provider specific APIs.  You will have much greater portability
success between different NMS providers.

IConnectionFactory cf = new NMSConnectionFactory(providerURLs,
connectionID);
IConnection connection = cf.CreateConnection(userName, password);


Best,
Jim



On Thu, Jun 5, 2014 at 10:55 AM, pwalter <pa...@nasa.gov> wrote:

> ActiveMQ NMS fails when User/Password is required. ActiveMQ with JAVA works
> with same URL/user/pwd.
>
>                 Uri connecturi = new Uri(url);
>                 IConnectionFactory factory = new
> Apache.NMS.ActiveMQ.ConnectionFactory(connecturi);
>
>                 connection = factory.CreateConnection(user, password);
>                 connection.Start();
>
> Error: Apache.NMS.ActiveMQ.ConnectionClosedException: The connection is
> already closed!
>
> Any Ideas ??
> THANKS FOR YOUR QUICK RESPONSE!!!
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-NMS-Fails-when-User-Password-Required-tp4681728.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: ActiveMQ NMS Fails when User/Password Required

Posted by pwalter <pa...@nasa.gov>.
I downloaded the "most recent" NMS ActiveMQ (1.6.2) and got this error after
running the code:

System.IO.IOException was unhandled by user code
  HResult=-2146232800
  Message=The operation is not allowed on non-connected sockets.
  Source=System
  StackTrace:
       at System.Net.Sockets.NetworkStream.InitNetworkStream(Socket socket,
FileAccess Access)
       at System.Net.Sockets.NetworkStream..ctor(Socket socket)
       at
Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.CreateSocketStream()
       at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.Start()
       at Apache.NMS.ActiveMQ.Transport.TransportFilter.Start()
       at Apache.NMS.ActiveMQ.Transport.TransportFilter.Start()
       at Apache.NMS.ActiveMQ.Transport.WireFormatNegotiator.Start()
       at Apache.NMS.ActiveMQ.Transport.TransportFilter.Start()
       at Apache.NMS.ActiveMQ.Transport.TransportFilter.Start()
       at Apache.NMS.ActiveMQ.Connection.CheckConnected()
       at Apache.NMS.ActiveMQ.Connection.Start()
       at FdsMessaging.ConnectionActiveMQ.createConnection() in xxxxxxx

The operation mentioned in error above is connection.Start();

THANKS!!




--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-NMS-Fails-when-User-Password-Required-tp4681728p4681733.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.