You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by padcom <pa...@gmail.com> on 2009/03/12 22:38:20 UTC

ActiveMQ usage from C# (WITHOUT SPRING.NET)

Hi there,

I'm hoping someone here will be able to help me out as this is getting
pretty interesting for me. 
Here's the problem:

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

namespace JMSTest {
	class Program {
		static void Main(string[] args) {
			IConnectionFactory factory = new
ConnectionFactory("tcp://localhost:61616/");
			IConnection connection = factory.CreateConnection();
			ISession session = connection.CreateSession();
		}
	}
}

Would anyone please explain to me what am I doing wrong that I can't even
create a session? I have my ActiveMQ instance up and running, other clients
(Java) work just fine, but doing just that in C# throws the following
exception:

System.ArgumentOutOfRangeException: Index and length must refer to a
location within the string.
Parameter name: length
   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32
length, Boolean fAlwaysCopy)
   at System.String.Substring(Int32 startIndex, Int32 length)
   at
Apache.NMS.ActiveMQ.OpenWire.StringPackageSplitter.StringPackageSplitterEnumerator.System.Collections.IEnumerator.get_Current()
   at Apache.NMS.ActiveMQ.OpenWire.OpenWireBinaryWriter.Write(String text)
   at
Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalString(String
value, BinaryWriter dataOut)
   at
Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionIdMarshaller.LooseMarshal(OpenWireFormat
wireFormat, Object o, BinaryWriter dataOut)
   at
Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.LooseMarshalNestedObject(DataStructure
o, BinaryWriter dataOut)
   at
Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalCachedObject(OpenWireFormat
wireFormat, DataStructure o, BinaryWriter dataOut)
   at
Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionInfoMarshaller.LooseMarshal(OpenWireFormat
wireFormat, Object o, BinaryWriter dataOut)
   at Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.Marshal(Object o,
BinaryWriter ds)
   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.Oneway(Command command)
: Transport connection error: Index and length must refer to a location
within the string.
Parameter name: length

Please help!!!

Best regards,
Maciej

-- 
View this message in context: http://www.nabble.com/ActiveMQ-usage-from-C--%28WITHOUT-SPRING.NET%29-tp22485816p22485816.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ActiveMQ usage from C# (WITHOUT SPRING.NET)

Posted by padcom <pa...@gmail.com>.
Hi there,

so I've tried to build it using NAnt (the latest I could find) and it failed
with some strange error message. Nevertheless I've stripped the downloading
part from csproj files (the Apache.NMS and Apache.NMS.ActiveMQ) and created
a new solution where ActiveMQ project depends on the NMS one and that did
the trick.

Finally I've ran my example and it did indeed work. Thank for the tip!



padcom wrote:
> 
> No - I used that what was already in the repository. I'll try to build it
> myself and I'll get back to you.
> 
> 
> semog wrote:
>> 
>> This is a bug that was fixed. If you get latest you should have better
>> success. 
>> 
>> - Jim
>> 
>> -----Original Message-----
>> From: pclovec <pc...@gmail.com>
>> 
>> Date: Thu, 12 Mar 2009 15:49:22 
>> To: <us...@activemq.apache.org>
>> Subject: Re: ActiveMQ usage from C# (WITHOUT SPRING.NET)
>> 
>> 
>> 
>> i used the dll now ,but i didn't saw this issue. did u build the dll by
>> self.? 
>> 
>> 
>> padcom wrote:
>>> 
>>> Hi there,
>>> 
>>> I'm hoping someone here will be able to help me out as this is getting
>>> pretty interesting for me. 
>>> Here's the problem:
>>> 
>>> using Apache.NMS;
>>> using Apache.NMS.ActiveMQ;
>>> 
>>> namespace JMSTest {
>>> 	class Program {
>>> 		static void Main(string[] args) {
>>> 			IConnectionFactory factory = new
>>> ConnectionFactory("tcp://localhost:61616/");
>>> 			IConnection connection = factory.CreateConnection();
>>> 			ISession session = connection.CreateSession();
>>> 		}
>>> 	}
>>> }
>>> 
>>> Would anyone please explain to me what am I doing wrong that I can't
>>> even
>>> create a session? I have my ActiveMQ instance up and running, other
>>> clients (Java) work just fine, but doing just that in C# throws the
>>> following exception:
>>> 
>>> System.ArgumentOutOfRangeException: Index and length must refer to a
>>> location within the string.
>>> Parameter name: length
>>>    at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32
>>> length, Boolean fAlwaysCopy)
>>>    at System.String.Substring(Int32 startIndex, Int32 length)
>>>    at
>>> Apache.NMS.ActiveMQ.OpenWire.StringPackageSplitter.StringPackageSplitterEnumerator.System.Collections.IEnumerator.get_Current()
>>>    at Apache.NMS.ActiveMQ.OpenWire.OpenWireBinaryWriter.Write(String
>>> text)
>>>    at
>>> Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalString(String
>>> value, BinaryWriter dataOut)
>>>    at
>>> Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionIdMarshaller.LooseMarshal(OpenWireFormat
>>> wireFormat, Object o, BinaryWriter dataOut)
>>>    at
>>> Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.LooseMarshalNestedObject(DataStructure
>>> o, BinaryWriter dataOut)
>>>    at
>>> Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalCachedObject(OpenWireFormat
>>> wireFormat, DataStructure o, BinaryWriter dataOut)
>>>    at
>>> Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionInfoMarshaller.LooseMarshal(OpenWireFormat
>>> wireFormat, Object o, BinaryWriter dataOut)
>>>    at Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.Marshal(Object o,
>>> BinaryWriter ds)
>>>    at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.Oneway(Command
>>> command) : Transport connection error: Index and length must refer to a
>>> location within the string.
>>> Parameter name: length
>>> 
>>> Please help!!!
>>> 
>>> Best regards,
>>> Maciej
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/ActiveMQ-usage-from-C--%28WITHOUT-SPRING.NET%29-tp22485816p22486794.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ActiveMQ-usage-from-C--%28WITHOUT-SPRING.NET%29-tp22485816p22517058.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ActiveMQ usage from C# (WITHOUT SPRING.NET)

Posted by padcom <pa...@gmail.com>.
No - I used that what was already in the repository. I'll try to build it
myself and I'll get back to you.


semog wrote:
> 
> This is a bug that was fixed. If you get latest you should have better
> success. 
> 
> - Jim
> 
> -----Original Message-----
> From: pclovec <pc...@gmail.com>
> 
> Date: Thu, 12 Mar 2009 15:49:22 
> To: <us...@activemq.apache.org>
> Subject: Re: ActiveMQ usage from C# (WITHOUT SPRING.NET)
> 
> 
> 
> i used the dll now ,but i didn't saw this issue. did u build the dll by
> self.? 
> 
> 
> padcom wrote:
>> 
>> Hi there,
>> 
>> I'm hoping someone here will be able to help me out as this is getting
>> pretty interesting for me. 
>> Here's the problem:
>> 
>> using Apache.NMS;
>> using Apache.NMS.ActiveMQ;
>> 
>> namespace JMSTest {
>> 	class Program {
>> 		static void Main(string[] args) {
>> 			IConnectionFactory factory = new
>> ConnectionFactory("tcp://localhost:61616/");
>> 			IConnection connection = factory.CreateConnection();
>> 			ISession session = connection.CreateSession();
>> 		}
>> 	}
>> }
>> 
>> Would anyone please explain to me what am I doing wrong that I can't even
>> create a session? I have my ActiveMQ instance up and running, other
>> clients (Java) work just fine, but doing just that in C# throws the
>> following exception:
>> 
>> System.ArgumentOutOfRangeException: Index and length must refer to a
>> location within the string.
>> Parameter name: length
>>    at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32
>> length, Boolean fAlwaysCopy)
>>    at System.String.Substring(Int32 startIndex, Int32 length)
>>    at
>> Apache.NMS.ActiveMQ.OpenWire.StringPackageSplitter.StringPackageSplitterEnumerator.System.Collections.IEnumerator.get_Current()
>>    at Apache.NMS.ActiveMQ.OpenWire.OpenWireBinaryWriter.Write(String
>> text)
>>    at
>> Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalString(String
>> value, BinaryWriter dataOut)
>>    at
>> Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionIdMarshaller.LooseMarshal(OpenWireFormat
>> wireFormat, Object o, BinaryWriter dataOut)
>>    at
>> Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.LooseMarshalNestedObject(DataStructure
>> o, BinaryWriter dataOut)
>>    at
>> Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalCachedObject(OpenWireFormat
>> wireFormat, DataStructure o, BinaryWriter dataOut)
>>    at
>> Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionInfoMarshaller.LooseMarshal(OpenWireFormat
>> wireFormat, Object o, BinaryWriter dataOut)
>>    at Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.Marshal(Object o,
>> BinaryWriter ds)
>>    at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.Oneway(Command
>> command) : Transport connection error: Index and length must refer to a
>> location within the string.
>> Parameter name: length
>> 
>> Please help!!!
>> 
>> Best regards,
>> Maciej
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/ActiveMQ-usage-from-C--%28WITHOUT-SPRING.NET%29-tp22485816p22486794.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ActiveMQ-usage-from-C--%28WITHOUT-SPRING.NET%29-tp22485816p22516726.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ActiveMQ usage from C# (WITHOUT SPRING.NET)

Posted by Jim Gomes <e....@gmail.com>.
This is a bug that was fixed. If you get latest you should have better success. 

- Jim

-----Original Message-----
From: pclovec <pc...@gmail.com>

Date: Thu, 12 Mar 2009 15:49:22 
To: <us...@activemq.apache.org>
Subject: Re: ActiveMQ usage from C# (WITHOUT SPRING.NET)



i used the dll now ,but i didn't saw this issue. did u build the dll by
self.? 


padcom wrote:
> 
> Hi there,
> 
> I'm hoping someone here will be able to help me out as this is getting
> pretty interesting for me. 
> Here's the problem:
> 
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> 
> namespace JMSTest {
> 	class Program {
> 		static void Main(string[] args) {
> 			IConnectionFactory factory = new
> ConnectionFactory("tcp://localhost:61616/");
> 			IConnection connection = factory.CreateConnection();
> 			ISession session = connection.CreateSession();
> 		}
> 	}
> }
> 
> Would anyone please explain to me what am I doing wrong that I can't even
> create a session? I have my ActiveMQ instance up and running, other
> clients (Java) work just fine, but doing just that in C# throws the
> following exception:
> 
> System.ArgumentOutOfRangeException: Index and length must refer to a
> location within the string.
> Parameter name: length
>    at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32
> length, Boolean fAlwaysCopy)
>    at System.String.Substring(Int32 startIndex, Int32 length)
>    at
> Apache.NMS.ActiveMQ.OpenWire.StringPackageSplitter.StringPackageSplitterEnumerator.System.Collections.IEnumerator.get_Current()
>    at Apache.NMS.ActiveMQ.OpenWire.OpenWireBinaryWriter.Write(String text)
>    at
> Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalString(String
> value, BinaryWriter dataOut)
>    at
> Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionIdMarshaller.LooseMarshal(OpenWireFormat
> wireFormat, Object o, BinaryWriter dataOut)
>    at
> Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.LooseMarshalNestedObject(DataStructure
> o, BinaryWriter dataOut)
>    at
> Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalCachedObject(OpenWireFormat
> wireFormat, DataStructure o, BinaryWriter dataOut)
>    at
> Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionInfoMarshaller.LooseMarshal(OpenWireFormat
> wireFormat, Object o, BinaryWriter dataOut)
>    at Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.Marshal(Object o,
> BinaryWriter ds)
>    at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.Oneway(Command
> command) : Transport connection error: Index and length must refer to a
> location within the string.
> Parameter name: length
> 
> Please help!!!
> 
> Best regards,
> Maciej
> 
> 

-- 
View this message in context: http://www.nabble.com/ActiveMQ-usage-from-C--%28WITHOUT-SPRING.NET%29-tp22485816p22486794.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ActiveMQ usage from C# (WITHOUT SPRING.NET)

Posted by pclovec <pc...@gmail.com>.
i used the dll now ,but i didn't saw this issue. did u build the dll by
self.? 


padcom wrote:
> 
> Hi there,
> 
> I'm hoping someone here will be able to help me out as this is getting
> pretty interesting for me. 
> Here's the problem:
> 
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> 
> namespace JMSTest {
> 	class Program {
> 		static void Main(string[] args) {
> 			IConnectionFactory factory = new
> ConnectionFactory("tcp://localhost:61616/");
> 			IConnection connection = factory.CreateConnection();
> 			ISession session = connection.CreateSession();
> 		}
> 	}
> }
> 
> Would anyone please explain to me what am I doing wrong that I can't even
> create a session? I have my ActiveMQ instance up and running, other
> clients (Java) work just fine, but doing just that in C# throws the
> following exception:
> 
> System.ArgumentOutOfRangeException: Index and length must refer to a
> location within the string.
> Parameter name: length
>    at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32
> length, Boolean fAlwaysCopy)
>    at System.String.Substring(Int32 startIndex, Int32 length)
>    at
> Apache.NMS.ActiveMQ.OpenWire.StringPackageSplitter.StringPackageSplitterEnumerator.System.Collections.IEnumerator.get_Current()
>    at Apache.NMS.ActiveMQ.OpenWire.OpenWireBinaryWriter.Write(String text)
>    at
> Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalString(String
> value, BinaryWriter dataOut)
>    at
> Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionIdMarshaller.LooseMarshal(OpenWireFormat
> wireFormat, Object o, BinaryWriter dataOut)
>    at
> Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.LooseMarshalNestedObject(DataStructure
> o, BinaryWriter dataOut)
>    at
> Apache.NMS.ActiveMQ.OpenWire.BaseDataStreamMarshaller.LooseMarshalCachedObject(OpenWireFormat
> wireFormat, DataStructure o, BinaryWriter dataOut)
>    at
> Apache.NMS.ActiveMQ.OpenWire.V2.ConnectionInfoMarshaller.LooseMarshal(OpenWireFormat
> wireFormat, Object o, BinaryWriter dataOut)
>    at Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.Marshal(Object o,
> BinaryWriter ds)
>    at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.Oneway(Command
> command) : Transport connection error: Index and length must refer to a
> location within the string.
> Parameter name: length
> 
> Please help!!!
> 
> Best regards,
> Maciej
> 
> 

-- 
View this message in context: http://www.nabble.com/ActiveMQ-usage-from-C--%28WITHOUT-SPRING.NET%29-tp22485816p22486794.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.