Return-Path: X-Original-To: apmail-activemq-dev-archive@www.apache.org Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 074919612 for ; Thu, 24 Nov 2011 09:47:08 +0000 (UTC) Received: (qmail 45997 invoked by uid 500); 24 Nov 2011 09:47:07 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 45816 invoked by uid 500); 24 Nov 2011 09:47:05 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 45808 invoked by uid 99); 24 Nov 2011 09:47:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Nov 2011 09:47:04 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Nov 2011 09:47:01 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id E46B39C635 for ; Thu, 24 Nov 2011 09:46:39 +0000 (UTC) Date: Thu, 24 Nov 2011 09:46:39 +0000 (UTC) From: "Marc Giavarra (Created) (JIRA)" To: dev@activemq.apache.org Message-ID: <738648834.9301.1322127999937.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (AMQNET-355) Run as windows service: Need reconnect to establish the connection to the ActiveMQ Server MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org Run as windows service: Need reconnect to establish the connection to the A= ctiveMQ Server ---------------------------------------------------------------------------= -------------- Key: AMQNET-355 URL: https://issues.apache.org/jira/browse/AMQNET-355 Project: ActiveMQ .Net Issue Type: Task Components: ActiveMQ, NMS Affects Versions: 1.5.2, 1.5.1 Environment: Windows7 32Bit pro SP1 / Windows XP pro SP3 / Window= s 2003 R2 32Bit Standard SP2 ActiveMQ Version: 5.5.0 Reporter: Marc Giavarra Assignee: Jim Gomes Priority: Minor I am using the latest version of NMS to connect to an ActiveMQ Server (vers= ion 5.5.0). If you use this snippet in a windows service, you get an EndOfStreamExcepti= on/ConnectionClosedException at the first call of "this.connection.Start();= ". If you call "CreateConnection" and "Start" once again, everything works = fine. In a normal windows application you do not need to recall. Code: protected override void OnStart(string[] args) { // Install service // c:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.ex= e C:\Sandbox\CS_2011.483\Unproduktiv\WebSocketTestService\bin\Debug\WWWebSo= cketService.exe try { Apache.NMS.IConnectionFactory connectionFactory =3D new Apa= che.NMS.ActiveMQ.ConnectionFactory("ssl://xxxxx"); System.Diagnostics.Trace.WriteLine("Create connection"); this.connection =3D connectionFactory.CreateConnection("Mes= sageBrokerUsername", "MessageBrokerPassword"); this.connection.ExceptionListener +=3D new Apache.NMS.Excep= tionListener(connection_ExceptionListener); System.Diagnostics.Trace.WriteLine("Start connection."); bool connected =3D false; int connectionCounter =3D 0; while (!connected) { try { connectionCounter++; this.connection.Start(); connected =3D this.connection.IsStarted; } catch (System.Exception ex) { this.connection.Dispose(); System.Diagnostics.Trace.WriteLine(ex.ToString()); System.Diagnostics.Trace.WriteLine("Tries to connec= t: " + connectionCounter.ToString()); System.Threading.Thread.Sleep(3000); // do reconnect this.connection =3D connectionFactory.CreateConnect= ion("MessageBrokerUsername", "MessageBrokerPassword"); } } System.Diagnostics.Trace.WriteLine("Tries to connect: " + c= onnectionCounter.ToString()); this.session =3D connection.CreateSession(); System.Diagnostics.Trace.WriteLine("Create queue."); Apache.NMS.IDestination destination =3D new Apache.NMS.Acti= veMQ.Commands.ActiveMQQueue("test"); System.Diagnostics.Trace.WriteLine("Create consumer."); this.consumer =3D session.CreateConsumer(destination); this.consumer.Listener +=3D new Apache.NMS.MessageListener(= consumer_Listener); } catch (System.Exception ex) { System.Diagnostics.Trace.WriteLine(ex.ToString()); } } OS: Windows XP pro SP3 // Windows 2003 R2 32Bit Standard SP2 User: Local System // administrator Debug output [3996] Create connection=20 [3996] Start connection.=20 [3996] Apache.NMS.ActiveMQ.ConnectionClosedException: The connection is alr= eady closed!=20 [3996] at Apache.NMS.ActiveMQ.Connection.CheckConnected() in c:\Sandbox\= activemq-dotnet\Apache.NMS.ActiveMQ\trunk\src\main\csharp\Connection.cs:lin= e 821=20 [3996] at Apache.NMS.ActiveMQ.Connection.Start() in c:\Sandbox\activemq-= dotnet\Apache.NMS.ActiveMQ\trunk\src\main\csharp\Connection.cs:line 419=20 [3996] at WebSocketTestService.WebSocketService.OnStart(String[] args) i= n C:\Sandbox\CS_2011.483\Unproduktiv\WebSocketTestService\WebSocketService.= cs:line 44=20 [3996] Tries to connect: 1=20 [3996] Apache.NMS.NMSException: Unable to read beyond the end of the stream= . ---> System.IO.EndOfStreamException: Unable to read beyond the end of the= stream.=20 [3996] at System.IO.__Error.EndOfFile()=20 [3996] at System.IO.BinaryReader.FillBuffer(Int32 numBytes)=20 [3996] at System.IO.BinaryReader.ReadInt32()=20 [3996] at Apache.NMS.Util.EndianBinaryReader.ReadInt32() in c:\Sandbox\a= ctivemq-dotnet\Apache.NMS\trunk\src\main\csharp\Util\EndianBinaryReader.cs:= line 135=20 [3996] at Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.Unmarshal(BinaryRe= ader dis) in c:\Sandbox\activemq-dotnet\Apache.NMS.ActiveMQ\trunk\src\main\= csharp\OpenWire\OpenWireFormat.cs:line 226=20 [3996] at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.ReadLoop() in c= :\Sandbox\activemq-dotnet\Apache.NMS.ActiveMQ\trunk\src\main\csharp\Transpo= rt\Tcp\TcpTransport.cs:line 281=20 [3996] --- End of inner exception stack trace ---=20 [3996] Tries to connect: 2=20 [3996] Create queue.=20 [3996] Create consumer.=20 OS: Windows7 32Bit pro SP1 User: Local System Debug output [7300] Create connection=20 [7300] Start connection.=20 [7300] Tries to connect: 1=20 [7300] Create queue.=20 [7300] Create consumer.=20 User: administrator Debug output [4128] Create connection=20 [4128] Start connection.=20 [4128] Apache.NMS.NMSException: =C3=9Cber das Ende des Streams hinaus kann = nicht gelesen werden. ---> System.IO.EndOfStreamException: =C3=9Cber das En= de des Streams hinaus kann nicht gelesen werden.=20 [4128] bei System.IO.__Error.EndOfFile()=20 [4128] bei System.IO.BinaryReader.FillBuffer(Int32 numBytes)=20 [4128] bei System.IO.BinaryReader.ReadInt32()=20 [4128] bei Apache.NMS.Util.EndianBinaryReader.ReadInt32() in c:\Sandbox\= activemq-dotnet\Apache.NMS\trunk\src\main\csharp\Util\EndianBinaryReader.cs= :Zeile 135.=20 [4128] bei Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.Unmarshal(BinaryR= eader dis) in c:\Sandbox\activemq-dotnet\Apache.NMS.ActiveMQ\trunk\src\main= \csharp\OpenWire\OpenWireFormat.cs:Zeile 226.=20 [4128] bei Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.ReadLoop() in = c:\Sandbox\activemq-dotnet\Apache.NMS.ActiveMQ\trunk\src\main\csharp\Transp= ort\Tcp\TcpTransport.cs:Zeile 281.=20 [4128] --- Ende der internen Ausnahmestapel=C3=BCberwachung ---=20 [4128] Apache.NMS.ActiveMQ.ConnectionClosedException: The connection is alr= eady closed!=20 [4128] bei Apache.NMS.ActiveMQ.Connection.CheckConnected() in c:\Sandbox= \activemq-dotnet\Apache.NMS.ActiveMQ\trunk\src\main\csharp\Connection.cs:Ze= ile 821.=20 [4128] bei Apache.NMS.ActiveMQ.Connection.Start() in c:\Sandbox\activemq= -dotnet\Apache.NMS.ActiveMQ\trunk\src\main\csharp\Connection.cs:Zeile 419.= =20 [4128] bei WebSocketTestService.WebSocketService.OnStart(String[] args) = in C:\Sandbox\CS_2011.483\Unproduktiv\WebSocketTestService\WebSocketService= .cs:Zeile 44.=20 [4128] Tries to connect: 1=20 [4128] Tries to connect: 2=20 [4128] Create queue.=20 [4128] Create consumer.=20 OS: An other Windows7 32Bit pro SP1 the opposite: administrator is ok; Local System throws the exception -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs: https://issues.apache.org/jira/secure/ContactAdministrators!default.jsp= a For more information on JIRA, see: http://www.atlassian.com/software/jira