You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Tomasz Wiczling (JIRA)" <ji...@apache.org> on 2008/12/16 15:55:05 UTC

[jira] Created: (AMQNET-135) Error in parsing composite Uri on Linux Mono

Error in parsing composite Uri on Linux Mono
--------------------------------------------

                 Key: AMQNET-135
                 URL: https://issues.apache.org/activemq/browse/AMQNET-135
             Project: ActiveMQ .Net
          Issue Type: Bug
          Components: ActiveMQ Client
         Environment: 1. ActiveMQ on linux CentOS 4.4
2. Client on Mono 1.9 on linux CentOS 4.4
            Reporter: Tomasz Wiczling
            Assignee: Jim Gomes
            Priority: Critical


I'm using ActiveMQ .Net to connect to ActiveMQ from Mono application on linux.
I've downloaded new (12-12-2008, rev. 726083) version of ActiveMQ .Net and started from testing new feature: FAILOVER transport.
First test made on Windows were very promising, but trying to run my application on linux caused an error.
I've invested it a bit and found out this:
On linux Mono the System.Uri constructor causes error while parsing composite uri, because it replaces all '//' with '/'. And tries to connect to 'tcp:/localhost:61616' for example.

I've tested it on newest Mono 2.0 SUSE with the same result.

Uris, I've tried:
failover:(tcp://192.168.44.244:61616)
failover:(tcp://192.168.44.244:61616)/
failover://localhost/(tcp://192.168.44.244:61616)
failover://localhost/(tcp://192.168.44.244:61616)/

All with the same result :((

Illustration.
I modified Apache.NMS.ActiveMQ.ConnectionFactory constructors as below:
(...)
		public ConnectionFactory(string brokerUri, string clientID)

			: this(new Uri(brokerUri), clientID)

		{

			Tracer.Debug("ConnectionFactory(string brokerUri, string clientID): brokerUri='" + brokerUri + "'");

		}

(...)
		public ConnectionFactory(Uri brokerUri, string clientID)

		{

			Tracer.Debug("ConnectionFactory(Uri brokerUri, string clientID): brokerUri='" + brokerUri + "'");

			this.brokerUri = brokerUri;

			this.clientId = clientID;

		}

(...)

and prepare simple islustrating program:

using System;

using Apache.NMS;

using Apache.NMS.ActiveMQ;



namespace IssueExample

{

	internal class ConsoleTracer : ITrace

	{

		public bool IsDebugEnabled { get { return true; } }

		public bool IsInfoEnabled { get { return true; } }

		public bool IsWarnEnabled { get { return true; } }

		public bool IsErrorEnabled { get { return true; } }

		public bool IsFatalEnabled { get { return true; } }

		public void Debug(string message) { Console.WriteLine("DEBUG:" + message); }

		public void Info(string message) { Console.WriteLine("INFO:" + message); }

		public void Warn(string message) { Console.WriteLine("WARN:" + message); }

		public void Error(string message) { Console.WriteLine("ERROR:" + message); }

		public void Fatal(object message) { Console.WriteLine("FATAL:" + message); }

	}



	class Program

	{

		public static void Main(string[] args)

		{

			Tracer.Trace = new ConsoleTracer();



			IConnectionFactory factory = new ConnectionFactory(args[0]);

			IConnection connection = factory.CreateConnection();

			connection.Close();

			Console.WriteLine("Connected and Disconnected successfully to '" + args[0] + "'");

			Console.ReadKey();

		}

	}

}

Running my program the output was:

# mono IssueExample.exe failover://localhost/\(tcp://192.168.44.244:61616\,tcp://192.168.44.244:61616\)/
DEBUG:ConnectionFactory(Uri brokerUri, string clientID): brokerUri='failover://localhost/(tcp:/192.168.44.244:61616,tcp:/192.168.44.244:61616)/'
DEBUG:ConnectionFactory(string brokerUri, string clientID): brokerUri='failover://localhost/(tcp://192.168.44.244:61616,tcp://192.168.44.244:61616)/'
DEBUG:Reconnect was triggered but transport is not started yet. Wait for start to connect the transport.
DEBUG:Started.
DEBUG:Creating reconnect task
DEBUG:Waking up reconnect task
INFO:Waiting for transport to reconnect.
DEBUG:Attempting connect to: tcp:/192.168.44.244:61616
DEBUG:Opening socket to:  on port: -1
DEBUG:Connect fail to: tcp:/192.168.44.244:61616, reason: System.ArgumentOutOfRangeException: Argument is out of range.
Parameter name: Invalid port
  at System.Net.IPEndPoint.set_Port (Int32 value) [0x00000]
  at System.Net.IPEndPoint..ctor (System.Net.IPAddress address, Int32 port) [0x00000]
  at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.Connect (System.String host, Int32 port) [0x00000]
  at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.CompositeConnect (System.Uri location) [0x00000]
  at Apache.NMS.ActiveMQ.Transport.TransportFactory.CompositeConnect (System.Uri location) [0x00000]
  at Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.doReconnect () [0x00000]
DEBUG:Waiting 10 ms before attempting connection.
(...)
<Infinit loop of reconnects>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AMQNET-135) Error in parsing composite Uri on Linux Mono

Posted by "Jim Gomes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQNET-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jim Gomes updated AMQNET-135:
-----------------------------

    Affects Version/s: 1.1
        Fix Version/s: 1.1

Hi Tomasz,

You reported that you are running on Mono 1.9.  Would you try upgrading to the latest Mono shipping version and re-test?  I will try testing this on Mono for Windows to see if I can reproduce.

> Error in parsing composite Uri on Linux Mono
> --------------------------------------------
>
>                 Key: AMQNET-135
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-135
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.1
>         Environment: 1. ActiveMQ on linux CentOS 4.4
> 2. Client on Mono 1.9 on linux CentOS 4.4
>            Reporter: Tomasz Wiczling
>            Assignee: Jim Gomes
>            Priority: Critical
>             Fix For: 1.1
>
>
> I'm using ActiveMQ .Net to connect to ActiveMQ from Mono application on linux.
> I've downloaded new (12-12-2008, rev. 726083) version of ActiveMQ .Net and started from testing new feature: FAILOVER transport.
> First test made on Windows were very promising, but trying to run my application on linux caused an error.
> I've invested it a bit and found out this:
> On linux Mono the System.Uri constructor causes error while parsing composite uri, because it replaces all '//' with '/'. And tries to connect to 'tcp:/localhost:61616' for example.
> I've tested it on newest Mono 2.0 SUSE with the same result.
> Uris, I've tried:
> failover:(tcp://192.168.44.244:61616)
> failover:(tcp://192.168.44.244:61616)/
> failover://localhost/(tcp://192.168.44.244:61616)
> failover://localhost/(tcp://192.168.44.244:61616)/
> All with the same result :((
> Illustration.
> I modified Apache.NMS.ActiveMQ.ConnectionFactory constructors as below:
> (...)
> 		public ConnectionFactory(string brokerUri, string clientID)
> 			: this(new Uri(brokerUri), clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(string brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 		}
> (...)
> 		public ConnectionFactory(Uri brokerUri, string clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(Uri brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 			this.brokerUri = brokerUri;
> 			this.clientId = clientID;
> 		}
> (...)
> and prepare simple islustrating program:
> using System;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> namespace IssueExample
> {
> 	internal class ConsoleTracer : ITrace
> 	{
> 		public bool IsDebugEnabled { get { return true; } }
> 		public bool IsInfoEnabled { get { return true; } }
> 		public bool IsWarnEnabled { get { return true; } }
> 		public bool IsErrorEnabled { get { return true; } }
> 		public bool IsFatalEnabled { get { return true; } }
> 		public void Debug(string message) { Console.WriteLine("DEBUG:" + message); }
> 		public void Info(string message) { Console.WriteLine("INFO:" + message); }
> 		public void Warn(string message) { Console.WriteLine("WARN:" + message); }
> 		public void Error(string message) { Console.WriteLine("ERROR:" + message); }
> 		public void Fatal(object message) { Console.WriteLine("FATAL:" + message); }
> 	}
> 	class Program
> 	{
> 		public static void Main(string[] args)
> 		{
> 			Tracer.Trace = new ConsoleTracer();
> 			IConnectionFactory factory = new ConnectionFactory(args[0]);
> 			IConnection connection = factory.CreateConnection();
> 			connection.Close();
> 			Console.WriteLine("Connected and Disconnected successfully to '" + args[0] + "'");
> 			Console.ReadKey();
> 		}
> 	}
> }
> Running my program the output was:
> # mono IssueExample.exe failover://localhost/\(tcp://192.168.44.244:61616\,tcp://192.168.44.244:61616\)/
> DEBUG:ConnectionFactory(Uri brokerUri, string clientID): brokerUri='failover://localhost/(tcp:/192.168.44.244:61616,tcp:/192.168.44.244:61616)/'
> DEBUG:ConnectionFactory(string brokerUri, string clientID): brokerUri='failover://localhost/(tcp://192.168.44.244:61616,tcp://192.168.44.244:61616)/'
> DEBUG:Reconnect was triggered but transport is not started yet. Wait for start to connect the transport.
> DEBUG:Started.
> DEBUG:Creating reconnect task
> DEBUG:Waking up reconnect task
> INFO:Waiting for transport to reconnect.
> DEBUG:Attempting connect to: tcp:/192.168.44.244:61616
> DEBUG:Opening socket to:  on port: -1
> DEBUG:Connect fail to: tcp:/192.168.44.244:61616, reason: System.ArgumentOutOfRangeException: Argument is out of range.
> Parameter name: Invalid port
>   at System.Net.IPEndPoint.set_Port (Int32 value) [0x00000]
>   at System.Net.IPEndPoint..ctor (System.Net.IPAddress address, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.Connect (System.String host, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.TransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.doReconnect () [0x00000]
> DEBUG:Waiting 10 ms before attempting connection.
> (...)
> <Infinit loop of reconnects>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (AMQNET-135) Error in parsing composite Uri on Linux Mono

Posted by "Jim Gomes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQNET-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jim Gomes resolved AMQNET-135.
------------------------------

    Resolution: Fixed

Applied patch from Allan Schrum.  Thanks, Allan!

> Error in parsing composite Uri on Linux Mono
> --------------------------------------------
>
>                 Key: AMQNET-135
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-135
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.1
>         Environment: 1. ActiveMQ on linux CentOS 4.4
> 2. Client on Mono 1.9 on linux CentOS 4.4
>            Reporter: Tomasz Wiczling
>            Assignee: Jim Gomes
>            Priority: Critical
>             Fix For: 1.1
>
>         Attachments: AMQNET-135-741308.diff
>
>
> I'm using ActiveMQ .Net to connect to ActiveMQ from Mono application on linux.
> I've downloaded new (12-12-2008, rev. 726083) version of ActiveMQ .Net and started from testing new feature: FAILOVER transport.
> First test made on Windows were very promising, but trying to run my application on linux caused an error.
> I've invested it a bit and found out this:
> On linux Mono the System.Uri constructor causes error while parsing composite uri, because it replaces all '//' with '/'. And tries to connect to 'tcp:/localhost:61616' for example.
> I've tested it on newest Mono 2.0 SUSE with the same result.
> Uris, I've tried:
> failover:(tcp://192.168.44.244:61616)
> failover:(tcp://192.168.44.244:61616)/
> failover://localhost/(tcp://192.168.44.244:61616)
> failover://localhost/(tcp://192.168.44.244:61616)/
> All with the same result :((
> Illustration.
> I modified Apache.NMS.ActiveMQ.ConnectionFactory constructors as below:
> (...)
> 		public ConnectionFactory(string brokerUri, string clientID)
> 			: this(new Uri(brokerUri), clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(string brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 		}
> (...)
> 		public ConnectionFactory(Uri brokerUri, string clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(Uri brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 			this.brokerUri = brokerUri;
> 			this.clientId = clientID;
> 		}
> (...)
> and prepare simple islustrating program:
> using System;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> namespace IssueExample
> {
> 	internal class ConsoleTracer : ITrace
> 	{
> 		public bool IsDebugEnabled { get { return true; } }
> 		public bool IsInfoEnabled { get { return true; } }
> 		public bool IsWarnEnabled { get { return true; } }
> 		public bool IsErrorEnabled { get { return true; } }
> 		public bool IsFatalEnabled { get { return true; } }
> 		public void Debug(string message) { Console.WriteLine("DEBUG:" + message); }
> 		public void Info(string message) { Console.WriteLine("INFO:" + message); }
> 		public void Warn(string message) { Console.WriteLine("WARN:" + message); }
> 		public void Error(string message) { Console.WriteLine("ERROR:" + message); }
> 		public void Fatal(object message) { Console.WriteLine("FATAL:" + message); }
> 	}
> 	class Program
> 	{
> 		public static void Main(string[] args)
> 		{
> 			Tracer.Trace = new ConsoleTracer();
> 			IConnectionFactory factory = new ConnectionFactory(args[0]);
> 			IConnection connection = factory.CreateConnection();
> 			connection.Close();
> 			Console.WriteLine("Connected and Disconnected successfully to '" + args[0] + "'");
> 			Console.ReadKey();
> 		}
> 	}
> }
> Running my program the output was:
> # mono IssueExample.exe failover://localhost/\(tcp://192.168.44.244:61616\,tcp://192.168.44.244:61616\)/
> DEBUG:ConnectionFactory(Uri brokerUri, string clientID): brokerUri='failover://localhost/(tcp:/192.168.44.244:61616,tcp:/192.168.44.244:61616)/'
> DEBUG:ConnectionFactory(string brokerUri, string clientID): brokerUri='failover://localhost/(tcp://192.168.44.244:61616,tcp://192.168.44.244:61616)/'
> DEBUG:Reconnect was triggered but transport is not started yet. Wait for start to connect the transport.
> DEBUG:Started.
> DEBUG:Creating reconnect task
> DEBUG:Waking up reconnect task
> INFO:Waiting for transport to reconnect.
> DEBUG:Attempting connect to: tcp:/192.168.44.244:61616
> DEBUG:Opening socket to:  on port: -1
> DEBUG:Connect fail to: tcp:/192.168.44.244:61616, reason: System.ArgumentOutOfRangeException: Argument is out of range.
> Parameter name: Invalid port
>   at System.Net.IPEndPoint.set_Port (Int32 value) [0x00000]
>   at System.Net.IPEndPoint..ctor (System.Net.IPAddress address, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.Connect (System.String host, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.TransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.doReconnect () [0x00000]
> DEBUG:Waiting 10 ms before attempting connection.
> (...)
> <Infinit loop of reconnects>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQNET-135) Error in parsing composite Uri on Linux Mono

Posted by "Tomasz Wiczling (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQNET-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=48220#action_48220 ] 

Tomasz Wiczling commented on AMQNET-135:
----------------------------------------

Hi Jim,

I've also written that I had tested it on latest Mono (2.0) with the same result.
On Windows everything works fine.

That is why I reported it. It's starange and I don't know how to resolve it.

> Error in parsing composite Uri on Linux Mono
> --------------------------------------------
>
>                 Key: AMQNET-135
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-135
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.1
>         Environment: 1. ActiveMQ on linux CentOS 4.4
> 2. Client on Mono 1.9 on linux CentOS 4.4
>            Reporter: Tomasz Wiczling
>            Assignee: Jim Gomes
>            Priority: Critical
>             Fix For: 1.1
>
>
> I'm using ActiveMQ .Net to connect to ActiveMQ from Mono application on linux.
> I've downloaded new (12-12-2008, rev. 726083) version of ActiveMQ .Net and started from testing new feature: FAILOVER transport.
> First test made on Windows were very promising, but trying to run my application on linux caused an error.
> I've invested it a bit and found out this:
> On linux Mono the System.Uri constructor causes error while parsing composite uri, because it replaces all '//' with '/'. And tries to connect to 'tcp:/localhost:61616' for example.
> I've tested it on newest Mono 2.0 SUSE with the same result.
> Uris, I've tried:
> failover:(tcp://192.168.44.244:61616)
> failover:(tcp://192.168.44.244:61616)/
> failover://localhost/(tcp://192.168.44.244:61616)
> failover://localhost/(tcp://192.168.44.244:61616)/
> All with the same result :((
> Illustration.
> I modified Apache.NMS.ActiveMQ.ConnectionFactory constructors as below:
> (...)
> 		public ConnectionFactory(string brokerUri, string clientID)
> 			: this(new Uri(brokerUri), clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(string brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 		}
> (...)
> 		public ConnectionFactory(Uri brokerUri, string clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(Uri brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 			this.brokerUri = brokerUri;
> 			this.clientId = clientID;
> 		}
> (...)
> and prepare simple islustrating program:
> using System;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> namespace IssueExample
> {
> 	internal class ConsoleTracer : ITrace
> 	{
> 		public bool IsDebugEnabled { get { return true; } }
> 		public bool IsInfoEnabled { get { return true; } }
> 		public bool IsWarnEnabled { get { return true; } }
> 		public bool IsErrorEnabled { get { return true; } }
> 		public bool IsFatalEnabled { get { return true; } }
> 		public void Debug(string message) { Console.WriteLine("DEBUG:" + message); }
> 		public void Info(string message) { Console.WriteLine("INFO:" + message); }
> 		public void Warn(string message) { Console.WriteLine("WARN:" + message); }
> 		public void Error(string message) { Console.WriteLine("ERROR:" + message); }
> 		public void Fatal(object message) { Console.WriteLine("FATAL:" + message); }
> 	}
> 	class Program
> 	{
> 		public static void Main(string[] args)
> 		{
> 			Tracer.Trace = new ConsoleTracer();
> 			IConnectionFactory factory = new ConnectionFactory(args[0]);
> 			IConnection connection = factory.CreateConnection();
> 			connection.Close();
> 			Console.WriteLine("Connected and Disconnected successfully to '" + args[0] + "'");
> 			Console.ReadKey();
> 		}
> 	}
> }
> Running my program the output was:
> # mono IssueExample.exe failover://localhost/\(tcp://192.168.44.244:61616\,tcp://192.168.44.244:61616\)/
> DEBUG:ConnectionFactory(Uri brokerUri, string clientID): brokerUri='failover://localhost/(tcp:/192.168.44.244:61616,tcp:/192.168.44.244:61616)/'
> DEBUG:ConnectionFactory(string brokerUri, string clientID): brokerUri='failover://localhost/(tcp://192.168.44.244:61616,tcp://192.168.44.244:61616)/'
> DEBUG:Reconnect was triggered but transport is not started yet. Wait for start to connect the transport.
> DEBUG:Started.
> DEBUG:Creating reconnect task
> DEBUG:Waking up reconnect task
> INFO:Waiting for transport to reconnect.
> DEBUG:Attempting connect to: tcp:/192.168.44.244:61616
> DEBUG:Opening socket to:  on port: -1
> DEBUG:Connect fail to: tcp:/192.168.44.244:61616, reason: System.ArgumentOutOfRangeException: Argument is out of range.
> Parameter name: Invalid port
>   at System.Net.IPEndPoint.set_Port (Int32 value) [0x00000]
>   at System.Net.IPEndPoint..ctor (System.Net.IPAddress address, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.Connect (System.String host, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.TransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.doReconnect () [0x00000]
> DEBUG:Waiting 10 ms before attempting connection.
> (...)
> <Infinit loop of reconnects>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AMQNET-135) Error in parsing composite Uri on Linux Mono

Posted by "Tomasz Wiczling (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQNET-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tomasz Wiczling updated AMQNET-135:
-----------------------------------

    Description: 
I'm using ActiveMQ .Net to connect to ActiveMQ from Mono application on linux.
I've downloaded new (12-12-2008, rev. 726083) version of ActiveMQ .Net and started from testing new feature: FAILOVER transport.
First test made on Windows were very promising, but trying to run my application on linux caused an error.
I've invested it a bit and found out this:
On linux Mono the System.Uri constructor causes error while parsing composite uri, because it replaces all '//' with '/'. And tries to connect to 'tcp:/localhost:61616' for example.

I've tested it on newest Mono 2.0 SUSE with the same result.

Uris, I've tried:
failover:(tcp://192.168.44.244:61616)
failover:(tcp://192.168.44.244:61616)/
failover://localhost/(tcp://192.168.44.244:61616)
failover://localhost/(tcp://192.168.44.244:61616)/

All with the same result :((

Illustration.
I modified Apache.NMS.ActiveMQ.ConnectionFactory constructors as below:
(...)
		public ConnectionFactory(string brokerUri, string clientID)
			: this(new Uri(brokerUri), clientID)
		{
			Tracer.Debug("ConnectionFactory(string brokerUri, string clientID): brokerUri='" + brokerUri + "'");
		}
(...)
		public ConnectionFactory(Uri brokerUri, string clientID)
		{
			Tracer.Debug("ConnectionFactory(Uri brokerUri, string clientID): brokerUri='" + brokerUri + "'");
			this.brokerUri = brokerUri;
			this.clientId = clientID;
		}
(...)

and prepare simple islustrating program:

using System;
using Apache.NMS;
using Apache.NMS.ActiveMQ;

namespace IssueExample
{
	internal class ConsoleTracer : ITrace
	{
		public bool IsDebugEnabled { get { return true; } }
		public bool IsInfoEnabled { get { return true; } }
		public bool IsWarnEnabled { get { return true; } }
		public bool IsErrorEnabled { get { return true; } }
		public bool IsFatalEnabled { get { return true; } }
		public void Debug(string message) { Console.WriteLine("DEBUG:" + message); }
		public void Info(string message) { Console.WriteLine("INFO:" + message); }
		public void Warn(string message) { Console.WriteLine("WARN:" + message); }
		public void Error(string message) { Console.WriteLine("ERROR:" + message); }
		public void Fatal(object message) { Console.WriteLine("FATAL:" + message); }
	}

	class Program
	{
		public static void Main(string[] args)
		{
			Tracer.Trace = new ConsoleTracer();
			IConnectionFactory factory = new ConnectionFactory(args[0]);
			IConnection connection = factory.CreateConnection();
			connection.Close();
			Console.WriteLine("Connected and Disconnected successfully to '" + args[0] + "'");
			Console.ReadKey();
		}
	}
}

Running my program the output was:

# mono IssueExample.exe failover://localhost/\(tcp://192.168.44.244:61616\,tcp://192.168.44.244:61616\)/
DEBUG:ConnectionFactory(Uri brokerUri, string clientID): brokerUri='failover://localhost/(tcp:/192.168.44.244:61616,tcp:/192.168.44.244:61616)/'
DEBUG:ConnectionFactory(string brokerUri, string clientID): brokerUri='failover://localhost/(tcp://192.168.44.244:61616,tcp://192.168.44.244:61616)/'
DEBUG:Reconnect was triggered but transport is not started yet. Wait for start to connect the transport.
DEBUG:Started.
DEBUG:Creating reconnect task
DEBUG:Waking up reconnect task
INFO:Waiting for transport to reconnect.
DEBUG:Attempting connect to: tcp:/192.168.44.244:61616
DEBUG:Opening socket to:  on port: -1
DEBUG:Connect fail to: tcp:/192.168.44.244:61616, reason: System.ArgumentOutOfRangeException: Argument is out of range.
Parameter name: Invalid port
  at System.Net.IPEndPoint.set_Port (Int32 value) [0x00000]
  at System.Net.IPEndPoint..ctor (System.Net.IPAddress address, Int32 port) [0x00000]
  at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.Connect (System.String host, Int32 port) [0x00000]
  at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.CompositeConnect (System.Uri location) [0x00000]
  at Apache.NMS.ActiveMQ.Transport.TransportFactory.CompositeConnect (System.Uri location) [0x00000]
  at Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.doReconnect () [0x00000]
DEBUG:Waiting 10 ms before attempting connection.
(...)
<Infinit loop of reconnects>

  was:
I'm using ActiveMQ .Net to connect to ActiveMQ from Mono application on linux.
I've downloaded new (12-12-2008, rev. 726083) version of ActiveMQ .Net and started from testing new feature: FAILOVER transport.
First test made on Windows were very promising, but trying to run my application on linux caused an error.
I've invested it a bit and found out this:
On linux Mono the System.Uri constructor causes error while parsing composite uri, because it replaces all '//' with '/'. And tries to connect to 'tcp:/localhost:61616' for example.

I've tested it on newest Mono 2.0 SUSE with the same result.

Uris, I've tried:
failover:(tcp://192.168.44.244:61616)
failover:(tcp://192.168.44.244:61616)/
failover://localhost/(tcp://192.168.44.244:61616)
failover://localhost/(tcp://192.168.44.244:61616)/

All with the same result :((

Illustration.
I modified Apache.NMS.ActiveMQ.ConnectionFactory constructors as below:
(...)
		public ConnectionFactory(string brokerUri, string clientID)

			: this(new Uri(brokerUri), clientID)

		{

			Tracer.Debug("ConnectionFactory(string brokerUri, string clientID): brokerUri='" + brokerUri + "'");

		}

(...)
		public ConnectionFactory(Uri brokerUri, string clientID)

		{

			Tracer.Debug("ConnectionFactory(Uri brokerUri, string clientID): brokerUri='" + brokerUri + "'");

			this.brokerUri = brokerUri;

			this.clientId = clientID;

		}

(...)

and prepare simple islustrating program:

using System;

using Apache.NMS;

using Apache.NMS.ActiveMQ;



namespace IssueExample

{

	internal class ConsoleTracer : ITrace

	{

		public bool IsDebugEnabled { get { return true; } }

		public bool IsInfoEnabled { get { return true; } }

		public bool IsWarnEnabled { get { return true; } }

		public bool IsErrorEnabled { get { return true; } }

		public bool IsFatalEnabled { get { return true; } }

		public void Debug(string message) { Console.WriteLine("DEBUG:" + message); }

		public void Info(string message) { Console.WriteLine("INFO:" + message); }

		public void Warn(string message) { Console.WriteLine("WARN:" + message); }

		public void Error(string message) { Console.WriteLine("ERROR:" + message); }

		public void Fatal(object message) { Console.WriteLine("FATAL:" + message); }

	}



	class Program

	{

		public static void Main(string[] args)

		{

			Tracer.Trace = new ConsoleTracer();



			IConnectionFactory factory = new ConnectionFactory(args[0]);

			IConnection connection = factory.CreateConnection();

			connection.Close();

			Console.WriteLine("Connected and Disconnected successfully to '" + args[0] + "'");

			Console.ReadKey();

		}

	}

}

Running my program the output was:

# mono IssueExample.exe failover://localhost/\(tcp://192.168.44.244:61616\,tcp://192.168.44.244:61616\)/
DEBUG:ConnectionFactory(Uri brokerUri, string clientID): brokerUri='failover://localhost/(tcp:/192.168.44.244:61616,tcp:/192.168.44.244:61616)/'
DEBUG:ConnectionFactory(string brokerUri, string clientID): brokerUri='failover://localhost/(tcp://192.168.44.244:61616,tcp://192.168.44.244:61616)/'
DEBUG:Reconnect was triggered but transport is not started yet. Wait for start to connect the transport.
DEBUG:Started.
DEBUG:Creating reconnect task
DEBUG:Waking up reconnect task
INFO:Waiting for transport to reconnect.
DEBUG:Attempting connect to: tcp:/192.168.44.244:61616
DEBUG:Opening socket to:  on port: -1
DEBUG:Connect fail to: tcp:/192.168.44.244:61616, reason: System.ArgumentOutOfRangeException: Argument is out of range.
Parameter name: Invalid port
  at System.Net.IPEndPoint.set_Port (Int32 value) [0x00000]
  at System.Net.IPEndPoint..ctor (System.Net.IPAddress address, Int32 port) [0x00000]
  at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.Connect (System.String host, Int32 port) [0x00000]
  at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.CompositeConnect (System.Uri location) [0x00000]
  at Apache.NMS.ActiveMQ.Transport.TransportFactory.CompositeConnect (System.Uri location) [0x00000]
  at Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.doReconnect () [0x00000]
DEBUG:Waiting 10 ms before attempting connection.
(...)
<Infinit loop of reconnects>


> Error in parsing composite Uri on Linux Mono
> --------------------------------------------
>
>                 Key: AMQNET-135
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-135
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>         Environment: 1. ActiveMQ on linux CentOS 4.4
> 2. Client on Mono 1.9 on linux CentOS 4.4
>            Reporter: Tomasz Wiczling
>            Assignee: Jim Gomes
>            Priority: Critical
>
> I'm using ActiveMQ .Net to connect to ActiveMQ from Mono application on linux.
> I've downloaded new (12-12-2008, rev. 726083) version of ActiveMQ .Net and started from testing new feature: FAILOVER transport.
> First test made on Windows were very promising, but trying to run my application on linux caused an error.
> I've invested it a bit and found out this:
> On linux Mono the System.Uri constructor causes error while parsing composite uri, because it replaces all '//' with '/'. And tries to connect to 'tcp:/localhost:61616' for example.
> I've tested it on newest Mono 2.0 SUSE with the same result.
> Uris, I've tried:
> failover:(tcp://192.168.44.244:61616)
> failover:(tcp://192.168.44.244:61616)/
> failover://localhost/(tcp://192.168.44.244:61616)
> failover://localhost/(tcp://192.168.44.244:61616)/
> All with the same result :((
> Illustration.
> I modified Apache.NMS.ActiveMQ.ConnectionFactory constructors as below:
> (...)
> 		public ConnectionFactory(string brokerUri, string clientID)
> 			: this(new Uri(brokerUri), clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(string brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 		}
> (...)
> 		public ConnectionFactory(Uri brokerUri, string clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(Uri brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 			this.brokerUri = brokerUri;
> 			this.clientId = clientID;
> 		}
> (...)
> and prepare simple islustrating program:
> using System;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> namespace IssueExample
> {
> 	internal class ConsoleTracer : ITrace
> 	{
> 		public bool IsDebugEnabled { get { return true; } }
> 		public bool IsInfoEnabled { get { return true; } }
> 		public bool IsWarnEnabled { get { return true; } }
> 		public bool IsErrorEnabled { get { return true; } }
> 		public bool IsFatalEnabled { get { return true; } }
> 		public void Debug(string message) { Console.WriteLine("DEBUG:" + message); }
> 		public void Info(string message) { Console.WriteLine("INFO:" + message); }
> 		public void Warn(string message) { Console.WriteLine("WARN:" + message); }
> 		public void Error(string message) { Console.WriteLine("ERROR:" + message); }
> 		public void Fatal(object message) { Console.WriteLine("FATAL:" + message); }
> 	}
> 	class Program
> 	{
> 		public static void Main(string[] args)
> 		{
> 			Tracer.Trace = new ConsoleTracer();
> 			IConnectionFactory factory = new ConnectionFactory(args[0]);
> 			IConnection connection = factory.CreateConnection();
> 			connection.Close();
> 			Console.WriteLine("Connected and Disconnected successfully to '" + args[0] + "'");
> 			Console.ReadKey();
> 		}
> 	}
> }
> Running my program the output was:
> # mono IssueExample.exe failover://localhost/\(tcp://192.168.44.244:61616\,tcp://192.168.44.244:61616\)/
> DEBUG:ConnectionFactory(Uri brokerUri, string clientID): brokerUri='failover://localhost/(tcp:/192.168.44.244:61616,tcp:/192.168.44.244:61616)/'
> DEBUG:ConnectionFactory(string brokerUri, string clientID): brokerUri='failover://localhost/(tcp://192.168.44.244:61616,tcp://192.168.44.244:61616)/'
> DEBUG:Reconnect was triggered but transport is not started yet. Wait for start to connect the transport.
> DEBUG:Started.
> DEBUG:Creating reconnect task
> DEBUG:Waking up reconnect task
> INFO:Waiting for transport to reconnect.
> DEBUG:Attempting connect to: tcp:/192.168.44.244:61616
> DEBUG:Opening socket to:  on port: -1
> DEBUG:Connect fail to: tcp:/192.168.44.244:61616, reason: System.ArgumentOutOfRangeException: Argument is out of range.
> Parameter name: Invalid port
>   at System.Net.IPEndPoint.set_Port (Int32 value) [0x00000]
>   at System.Net.IPEndPoint..ctor (System.Net.IPAddress address, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.Connect (System.String host, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.TransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.doReconnect () [0x00000]
> DEBUG:Waiting 10 ms before attempting connection.
> (...)
> <Infinit loop of reconnects>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AMQNET-135) Error in parsing composite Uri on Linux Mono

Posted by "Allan Schrum (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQNET-135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Allan Schrum updated AMQNET-135:
--------------------------------

    Attachment: AMQNET-135-741308.diff

After checking into the code change required, I think it is a simple case of reprocessing the original URI that is passed. Before, the System.Uri.AbsoluteUri was used to reprocess the composite URI. This modification uses System.Uri.OriginalString if not .NET 1.0 or 1.1. Thus we should avoid the Mono problem (bug?) that changes double slashes into single slashes since we are using the original string and not the processed string.

Can you please test and let us know if this works? This patch also includes to patch to AMQNET-140.


> Error in parsing composite Uri on Linux Mono
> --------------------------------------------
>
>                 Key: AMQNET-135
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-135
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.1
>         Environment: 1. ActiveMQ on linux CentOS 4.4
> 2. Client on Mono 1.9 on linux CentOS 4.4
>            Reporter: Tomasz Wiczling
>            Assignee: Jim Gomes
>            Priority: Critical
>             Fix For: 1.1
>
>         Attachments: AMQNET-135-741308.diff
>
>
> I'm using ActiveMQ .Net to connect to ActiveMQ from Mono application on linux.
> I've downloaded new (12-12-2008, rev. 726083) version of ActiveMQ .Net and started from testing new feature: FAILOVER transport.
> First test made on Windows were very promising, but trying to run my application on linux caused an error.
> I've invested it a bit and found out this:
> On linux Mono the System.Uri constructor causes error while parsing composite uri, because it replaces all '//' with '/'. And tries to connect to 'tcp:/localhost:61616' for example.
> I've tested it on newest Mono 2.0 SUSE with the same result.
> Uris, I've tried:
> failover:(tcp://192.168.44.244:61616)
> failover:(tcp://192.168.44.244:61616)/
> failover://localhost/(tcp://192.168.44.244:61616)
> failover://localhost/(tcp://192.168.44.244:61616)/
> All with the same result :((
> Illustration.
> I modified Apache.NMS.ActiveMQ.ConnectionFactory constructors as below:
> (...)
> 		public ConnectionFactory(string brokerUri, string clientID)
> 			: this(new Uri(brokerUri), clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(string brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 		}
> (...)
> 		public ConnectionFactory(Uri brokerUri, string clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(Uri brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 			this.brokerUri = brokerUri;
> 			this.clientId = clientID;
> 		}
> (...)
> and prepare simple islustrating program:
> using System;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> namespace IssueExample
> {
> 	internal class ConsoleTracer : ITrace
> 	{
> 		public bool IsDebugEnabled { get { return true; } }
> 		public bool IsInfoEnabled { get { return true; } }
> 		public bool IsWarnEnabled { get { return true; } }
> 		public bool IsErrorEnabled { get { return true; } }
> 		public bool IsFatalEnabled { get { return true; } }
> 		public void Debug(string message) { Console.WriteLine("DEBUG:" + message); }
> 		public void Info(string message) { Console.WriteLine("INFO:" + message); }
> 		public void Warn(string message) { Console.WriteLine("WARN:" + message); }
> 		public void Error(string message) { Console.WriteLine("ERROR:" + message); }
> 		public void Fatal(object message) { Console.WriteLine("FATAL:" + message); }
> 	}
> 	class Program
> 	{
> 		public static void Main(string[] args)
> 		{
> 			Tracer.Trace = new ConsoleTracer();
> 			IConnectionFactory factory = new ConnectionFactory(args[0]);
> 			IConnection connection = factory.CreateConnection();
> 			connection.Close();
> 			Console.WriteLine("Connected and Disconnected successfully to '" + args[0] + "'");
> 			Console.ReadKey();
> 		}
> 	}
> }
> Running my program the output was:
> # mono IssueExample.exe failover://localhost/\(tcp://192.168.44.244:61616\,tcp://192.168.44.244:61616\)/
> DEBUG:ConnectionFactory(Uri brokerUri, string clientID): brokerUri='failover://localhost/(tcp:/192.168.44.244:61616,tcp:/192.168.44.244:61616)/'
> DEBUG:ConnectionFactory(string brokerUri, string clientID): brokerUri='failover://localhost/(tcp://192.168.44.244:61616,tcp://192.168.44.244:61616)/'
> DEBUG:Reconnect was triggered but transport is not started yet. Wait for start to connect the transport.
> DEBUG:Started.
> DEBUG:Creating reconnect task
> DEBUG:Waking up reconnect task
> INFO:Waiting for transport to reconnect.
> DEBUG:Attempting connect to: tcp:/192.168.44.244:61616
> DEBUG:Opening socket to:  on port: -1
> DEBUG:Connect fail to: tcp:/192.168.44.244:61616, reason: System.ArgumentOutOfRangeException: Argument is out of range.
> Parameter name: Invalid port
>   at System.Net.IPEndPoint.set_Port (Int32 value) [0x00000]
>   at System.Net.IPEndPoint..ctor (System.Net.IPAddress address, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.Connect (System.String host, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.TransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.doReconnect () [0x00000]
> DEBUG:Waiting 10 ms before attempting connection.
> (...)
> <Infinit loop of reconnects>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQNET-135) Error in parsing composite Uri on Linux Mono

Posted by "Allan Schrum (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQNET-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=49193#action_49193 ] 

Allan Schrum commented on AMQNET-135:
-------------------------------------

I looked at RFC 2396 at http://www.rfc-editor.org/rfc/rfc2396.txt which deals with URI specifications. To support a failover URI which would include embedded URI of the failover hosts, we must use opaque URI (those which do not start with a leading slash). Otherwise we would need to escape all the contextually illegal characters found within the authority or path segments of an absolute URI. Thus, an acceptable URI for failover operation would be:

failover:(tcp://localhost:61616,tcp://localhost:61626,tcp://localhost:61636?param=true)?something=anything

In this mode, all the characters following "failover:" are opaque and should not be processed by System.Uri with the expectation that a host and path portion will be found. Unfortunately, Windows .NET 2.0 does not process an opaque URI very well, and Mono seems to edit its processing. Since we are using URI correctly (from the RFC point-of-view) the above sample should be what we use for failover operation. Since System.Uri does not support this type of URI very well, we will need to parse this more carefully in a more manual mode without relying upon System.Uri for the parsing of the outer failover: scheme.

Do you concur? If so, than I can take a look at seeing if I can modify the code to operate in this fashion.

> Error in parsing composite Uri on Linux Mono
> --------------------------------------------
>
>                 Key: AMQNET-135
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-135
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.1
>         Environment: 1. ActiveMQ on linux CentOS 4.4
> 2. Client on Mono 1.9 on linux CentOS 4.4
>            Reporter: Tomasz Wiczling
>            Assignee: Jim Gomes
>            Priority: Critical
>             Fix For: 1.1
>
>
> I'm using ActiveMQ .Net to connect to ActiveMQ from Mono application on linux.
> I've downloaded new (12-12-2008, rev. 726083) version of ActiveMQ .Net and started from testing new feature: FAILOVER transport.
> First test made on Windows were very promising, but trying to run my application on linux caused an error.
> I've invested it a bit and found out this:
> On linux Mono the System.Uri constructor causes error while parsing composite uri, because it replaces all '//' with '/'. And tries to connect to 'tcp:/localhost:61616' for example.
> I've tested it on newest Mono 2.0 SUSE with the same result.
> Uris, I've tried:
> failover:(tcp://192.168.44.244:61616)
> failover:(tcp://192.168.44.244:61616)/
> failover://localhost/(tcp://192.168.44.244:61616)
> failover://localhost/(tcp://192.168.44.244:61616)/
> All with the same result :((
> Illustration.
> I modified Apache.NMS.ActiveMQ.ConnectionFactory constructors as below:
> (...)
> 		public ConnectionFactory(string brokerUri, string clientID)
> 			: this(new Uri(brokerUri), clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(string brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 		}
> (...)
> 		public ConnectionFactory(Uri brokerUri, string clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(Uri brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 			this.brokerUri = brokerUri;
> 			this.clientId = clientID;
> 		}
> (...)
> and prepare simple islustrating program:
> using System;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> namespace IssueExample
> {
> 	internal class ConsoleTracer : ITrace
> 	{
> 		public bool IsDebugEnabled { get { return true; } }
> 		public bool IsInfoEnabled { get { return true; } }
> 		public bool IsWarnEnabled { get { return true; } }
> 		public bool IsErrorEnabled { get { return true; } }
> 		public bool IsFatalEnabled { get { return true; } }
> 		public void Debug(string message) { Console.WriteLine("DEBUG:" + message); }
> 		public void Info(string message) { Console.WriteLine("INFO:" + message); }
> 		public void Warn(string message) { Console.WriteLine("WARN:" + message); }
> 		public void Error(string message) { Console.WriteLine("ERROR:" + message); }
> 		public void Fatal(object message) { Console.WriteLine("FATAL:" + message); }
> 	}
> 	class Program
> 	{
> 		public static void Main(string[] args)
> 		{
> 			Tracer.Trace = new ConsoleTracer();
> 			IConnectionFactory factory = new ConnectionFactory(args[0]);
> 			IConnection connection = factory.CreateConnection();
> 			connection.Close();
> 			Console.WriteLine("Connected and Disconnected successfully to '" + args[0] + "'");
> 			Console.ReadKey();
> 		}
> 	}
> }
> Running my program the output was:
> # mono IssueExample.exe failover://localhost/\(tcp://192.168.44.244:61616\,tcp://192.168.44.244:61616\)/
> DEBUG:ConnectionFactory(Uri brokerUri, string clientID): brokerUri='failover://localhost/(tcp:/192.168.44.244:61616,tcp:/192.168.44.244:61616)/'
> DEBUG:ConnectionFactory(string brokerUri, string clientID): brokerUri='failover://localhost/(tcp://192.168.44.244:61616,tcp://192.168.44.244:61616)/'
> DEBUG:Reconnect was triggered but transport is not started yet. Wait for start to connect the transport.
> DEBUG:Started.
> DEBUG:Creating reconnect task
> DEBUG:Waking up reconnect task
> INFO:Waiting for transport to reconnect.
> DEBUG:Attempting connect to: tcp:/192.168.44.244:61616
> DEBUG:Opening socket to:  on port: -1
> DEBUG:Connect fail to: tcp:/192.168.44.244:61616, reason: System.ArgumentOutOfRangeException: Argument is out of range.
> Parameter name: Invalid port
>   at System.Net.IPEndPoint.set_Port (Int32 value) [0x00000]
>   at System.Net.IPEndPoint..ctor (System.Net.IPAddress address, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.Connect (System.String host, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.TransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.doReconnect () [0x00000]
> DEBUG:Waiting 10 ms before attempting connection.
> (...)
> <Infinit loop of reconnects>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQNET-135) Error in parsing composite Uri on Linux Mono

Posted by "Tomasz Wiczling (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQNET-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=49267#action_49267 ] 

Tomasz Wiczling commented on AMQNET-135:
----------------------------------------

Hi Allan,
the patch, you added, works fine.

Thanks.

> Error in parsing composite Uri on Linux Mono
> --------------------------------------------
>
>                 Key: AMQNET-135
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-135
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.1
>         Environment: 1. ActiveMQ on linux CentOS 4.4
> 2. Client on Mono 1.9 on linux CentOS 4.4
>            Reporter: Tomasz Wiczling
>            Assignee: Jim Gomes
>            Priority: Critical
>             Fix For: 1.1
>
>         Attachments: AMQNET-135-741308.diff
>
>
> I'm using ActiveMQ .Net to connect to ActiveMQ from Mono application on linux.
> I've downloaded new (12-12-2008, rev. 726083) version of ActiveMQ .Net and started from testing new feature: FAILOVER transport.
> First test made on Windows were very promising, but trying to run my application on linux caused an error.
> I've invested it a bit and found out this:
> On linux Mono the System.Uri constructor causes error while parsing composite uri, because it replaces all '//' with '/'. And tries to connect to 'tcp:/localhost:61616' for example.
> I've tested it on newest Mono 2.0 SUSE with the same result.
> Uris, I've tried:
> failover:(tcp://192.168.44.244:61616)
> failover:(tcp://192.168.44.244:61616)/
> failover://localhost/(tcp://192.168.44.244:61616)
> failover://localhost/(tcp://192.168.44.244:61616)/
> All with the same result :((
> Illustration.
> I modified Apache.NMS.ActiveMQ.ConnectionFactory constructors as below:
> (...)
> 		public ConnectionFactory(string brokerUri, string clientID)
> 			: this(new Uri(brokerUri), clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(string brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 		}
> (...)
> 		public ConnectionFactory(Uri brokerUri, string clientID)
> 		{
> 			Tracer.Debug("ConnectionFactory(Uri brokerUri, string clientID): brokerUri='" + brokerUri + "'");
> 			this.brokerUri = brokerUri;
> 			this.clientId = clientID;
> 		}
> (...)
> and prepare simple islustrating program:
> using System;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> namespace IssueExample
> {
> 	internal class ConsoleTracer : ITrace
> 	{
> 		public bool IsDebugEnabled { get { return true; } }
> 		public bool IsInfoEnabled { get { return true; } }
> 		public bool IsWarnEnabled { get { return true; } }
> 		public bool IsErrorEnabled { get { return true; } }
> 		public bool IsFatalEnabled { get { return true; } }
> 		public void Debug(string message) { Console.WriteLine("DEBUG:" + message); }
> 		public void Info(string message) { Console.WriteLine("INFO:" + message); }
> 		public void Warn(string message) { Console.WriteLine("WARN:" + message); }
> 		public void Error(string message) { Console.WriteLine("ERROR:" + message); }
> 		public void Fatal(object message) { Console.WriteLine("FATAL:" + message); }
> 	}
> 	class Program
> 	{
> 		public static void Main(string[] args)
> 		{
> 			Tracer.Trace = new ConsoleTracer();
> 			IConnectionFactory factory = new ConnectionFactory(args[0]);
> 			IConnection connection = factory.CreateConnection();
> 			connection.Close();
> 			Console.WriteLine("Connected and Disconnected successfully to '" + args[0] + "'");
> 			Console.ReadKey();
> 		}
> 	}
> }
> Running my program the output was:
> # mono IssueExample.exe failover://localhost/\(tcp://192.168.44.244:61616\,tcp://192.168.44.244:61616\)/
> DEBUG:ConnectionFactory(Uri brokerUri, string clientID): brokerUri='failover://localhost/(tcp:/192.168.44.244:61616,tcp:/192.168.44.244:61616)/'
> DEBUG:ConnectionFactory(string brokerUri, string clientID): brokerUri='failover://localhost/(tcp://192.168.44.244:61616,tcp://192.168.44.244:61616)/'
> DEBUG:Reconnect was triggered but transport is not started yet. Wait for start to connect the transport.
> DEBUG:Started.
> DEBUG:Creating reconnect task
> DEBUG:Waking up reconnect task
> INFO:Waiting for transport to reconnect.
> DEBUG:Attempting connect to: tcp:/192.168.44.244:61616
> DEBUG:Opening socket to:  on port: -1
> DEBUG:Connect fail to: tcp:/192.168.44.244:61616, reason: System.ArgumentOutOfRangeException: Argument is out of range.
> Parameter name: Invalid port
>   at System.Net.IPEndPoint.set_Port (Int32 value) [0x00000]
>   at System.Net.IPEndPoint..ctor (System.Net.IPAddress address, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.Connect (System.String host, Int32 port) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.TransportFactory.CompositeConnect (System.Uri location) [0x00000]
>   at Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.doReconnect () [0x00000]
> DEBUG:Waiting 10 ms before attempting connection.
> (...)
> <Infinit loop of reconnects>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.