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 122849A7D for ; Wed, 29 Feb 2012 22:00:23 +0000 (UTC) Received: (qmail 23554 invoked by uid 500); 29 Feb 2012 22:00:22 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 23506 invoked by uid 500); 29 Feb 2012 22:00:22 -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 23498 invoked by uid 99); 29 Feb 2012 22:00:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Feb 2012 22:00:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_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; Wed, 29 Feb 2012 22:00:19 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id AC9A1C7E6E for ; Wed, 29 Feb 2012 21:59:57 +0000 (UTC) Date: Wed, 29 Feb 2012 21:59:57 +0000 (UTC) From: "Jim Gomes (Resolved) (JIRA)" To: dev@activemq.apache.org Message-ID: <120824433.4984.1330552797708.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <738648834.9301.1322127999937.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Resolved] (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 [ https://issues.apache.org/jira/browse/AMQNET-355?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] Jim Gomes resolved AMQNET-355. ------------------------------ Resolution: Not A Problem Use of the failover protocol seem to have addressed this issue. =20 > Run as windows service: Need reconnect to establish the connection to the= ActiveMQ 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.1, 1.5.2 > Environment: Windows7 32Bit pro SP1 / Windows XP pro SP3 / Windo= ws 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 (ve= rsion 5.5.0). > If you use this snippet in a windows service, you get an EndOfStreamExcep= tion/ConnectionClosedException at the first call of "this.connection.Start(= );". If you call "CreateConnection" and "Start" once again, everything work= s 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.= exe C:\Sandbox\CS_2011.483\Unproduktiv\WebSocketTestService\bin\Debug\WWWeb= SocketService.exe > try > { > Apache.NMS.IConnectionFactory connectionFactory =3D new A= pache.NMS.ActiveMQ.ConnectionFactory("ssl://xxxxx"); > System.Diagnostics.Trace.WriteLine("Create connection"); > this.connection =3D connectionFactory.CreateConnection("M= essageBrokerUsername", "MessageBrokerPassword"); > this.connection.ExceptionListener +=3D new Apache.NMS.Exc= eptionListener(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 conn= ect: " + connectionCounter.ToString()); > System.Threading.Thread.Sleep(3000); > // do reconnect > this.connection =3D connectionFactory.CreateConne= ction("MessageBrokerUsername", "MessageBrokerPassword"); > } > } > System.Diagnostics.Trace.WriteLine("Tries to connect: " += connectionCounter.ToString()); > this.session =3D connection.CreateSession(); > System.Diagnostics.Trace.WriteLine("Create queue."); > Apache.NMS.IDestination destination =3D new Apache.NMS.Ac= tiveMQ.Commands.ActiveMQQueue("test"); > System.Diagnostics.Trace.WriteLine("Create consumer."); > this.consumer =3D session.CreateConsumer(destination); > this.consumer.Listener +=3D new Apache.NMS.MessageListene= r(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 a= lready closed!=20 > [3996] at Apache.NMS.ActiveMQ.Connection.CheckConnected() in c:\Sandbo= x\activemq-dotnet\Apache.NMS.ActiveMQ\trunk\src\main\csharp\Connection.cs:l= ine 821=20 > [3996] at Apache.NMS.ActiveMQ.Connection.Start() in c:\Sandbox\activem= q-dotnet\Apache.NMS.ActiveMQ\trunk\src\main\csharp\Connection.cs:line 419= =20 > [3996] at WebSocketTestService.WebSocketService.OnStart(String[] args)= in C:\Sandbox\CS_2011.483\Unproduktiv\WebSocketTestService\WebSocketServic= e.cs:line 44=20 > [3996] Tries to connect: 1=20 > [3996] Apache.NMS.NMSException: Unable to read beyond the end of the stre= am. ---> System.IO.EndOfStreamException: Unable to read beyond the end of t= he 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= \activemq-dotnet\Apache.NMS\trunk\src\main\csharp\Util\EndianBinaryReader.c= s:line 135=20 > [3996] at Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.Unmarshal(Binary= Reader dis) in c:\Sandbox\activemq-dotnet\Apache.NMS.ActiveMQ\trunk\src\mai= n\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\Trans= port\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 kan= n nicht gelesen werden. ---> System.IO.EndOfStreamException: =C3=9Cber das = Ende 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:\Sandbo= x\activemq-dotnet\Apache.NMS\trunk\src\main\csharp\Util\EndianBinaryReader.= cs:Zeile 135.=20 > [4128] bei Apache.NMS.ActiveMQ.OpenWire.OpenWireFormat.Unmarshal(Binar= yReader dis) in c:\Sandbox\activemq-dotnet\Apache.NMS.ActiveMQ\trunk\src\ma= in\csharp\OpenWire\OpenWireFormat.cs:Zeile 226.=20 > [4128] bei Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.ReadLoop() i= n c:\Sandbox\activemq-dotnet\Apache.NMS.ActiveMQ\trunk\src\main\csharp\Tran= sport\Tcp\TcpTransport.cs:Zeile 281.=20 > [4128] --- Ende der internen Ausnahmestapel=C3=BCberwachung ---=20 > [4128] Apache.NMS.ActiveMQ.ConnectionClosedException: The connection is a= lready closed!=20 > [4128] bei Apache.NMS.ActiveMQ.Connection.CheckConnected() in c:\Sandb= ox\activemq-dotnet\Apache.NMS.ActiveMQ\trunk\src\main\csharp\Connection.cs:= Zeile 821.=20 > [4128] bei Apache.NMS.ActiveMQ.Connection.Start() in c:\Sandbox\active= mq-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\WebSocketServi= ce.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