3

我正在连接到 JMS 队列。该队列由 WebSphere Application Server(版本 8.0.0.5)使用 SIBus 托管。

我有一个简单的程序来重现一些有问题的行为,它是用 C# 编写的,并使用 XMS(IBM 的 .NET API)连接到队列。注意:我从这里获得了 IBM.XMS dll:MQC71: WebSphere MQ V7.1 Clients

场景是这样的:

  1. 运行程序(使用一个空队列,因此它等待阻塞的接收调用)
  2. 断开网络(拔下以太网)
  3. 几分钟后,Receive 调用引发异常
  4. 程序尝试重新连接
  5. 由于网络关闭而失败
  6. ...让它循环一下以验证此错误是否不断发生
  7. 恢复网络(插入以太网)
  8. 继续发生相同的错误(使用 WireShark 验证在 connectionFactory.CreateConnection() 调用期间没有发生网络流量)

所以,问题是:为什么 CreateConnection() 调用什么都不做(不发送任何数据包)但失败了?

using IBM.XMS;
using System;

namespace SimpleTest
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                try
                {
                    string queueURI = "queue://your.details.GoHereDearReader";
                    string providerEndpoint = "1.2.3.4:1234";
                    string targetTransportChain = "InboundBasicMessaging";
                    string busName = "some_bus_name";

                    XMSFactoryFactory factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WPM);
                    IConnectionFactory connectionFactory = factoryFactory.CreateConnectionFactory();
                    connectionFactory.SetStringProperty(XMSC.WPM_PROVIDER_ENDPOINTS, providerEndpoint);
                    connectionFactory.SetStringProperty(XMSC.WPM_TARGET_TRANSPORT_CHAIN, targetTransportChain);
                    connectionFactory.SetStringProperty(XMSC.WPM_BUS_NAME, busName);

                    Log("Connecting...");
                    using (var connection = connectionFactory.CreateConnection())
                    {
                        using (var session = connection.CreateSession(false, AcknowledgeMode.AutoAcknowledge))
                        {
                            using (var destination = session.CreateQueue(queueURI))
                            {
                                destination.SetIntProperty(XMSC.DELIVERY_MODE, XMSC.DELIVERY_NOT_PERSISTENT);
                                connection.Start();

                                using (IMessageConsumer consumer =  session.CreateConsumer(destination))
                                {
                                    Log("Receiving...");
                                    IMessage recvMsg = consumer.Receive();
                                    Log("recvMsg:" + recvMsg);
                                }
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Log(e.ToString());
                }
                Log("Sleeping some before consuming more...");
                System.Threading.Thread.Sleep(10 * 1000);
            }//while
        }//Main

        static void Log(string text)
        {
            Console.WriteLine(DateTime.UtcNow.ToString("HH:mm:ss.fff") + "--------------------------  " + text);
        }

    }
}

还有一些输出:

16:38:19.483--------------------------  Connecting...
16:38:19.936--------------------------  Receiving...
16:43:31.952--------------------------  IBM.XMS.XMSException: EXCEPTION_RECEIVED_CWSIA0022
EXCEPTION_RECEIVED_CWSIA0022.explanation
EXCEPTION_RECEIVED_CWSIA0022.useraction
   at IBM.XMS.Impl.Connection.Dispose(Boolean disposing)
   at IBM.XMS.Impl.Connection.Dispose()
   at SimpleTest.Program.Main(String[] args) in c:\Users\Administrator\Documents\Visual Studio Projects\TestJMSDequeue\SimpleTest\Program.cs:line 43

Linked Exception : IBM.XMS.SIB.JFAP.JFapConversationClosedException: Exception of type 'IBM.XMS.SIB.JFAP.JFapConversationClosedException' was thrown.
   at IBM.XMS.SIB.JFAP.ConversationImpl.Send(IByteBuffer[] data, JFAPSegmentType segmentType, UInt16 requestNumber, IoPriority priority, Boolean pooledBufferHint, IReceiveListener recvListener, ISendListener sendListener, Object state)
   at IBM.XMS.SIB.JFAP.ConversationImpl.RequestReplyExchange(IByteBuffer[] data, JFAPSegmentType segmentType, UInt16 requestNumber, IoPriority priority, Boolean pooledBufferHint)
   at IBM.XMS.SIB.JFAP.ConversationImpl.RequestReplyExchange(IByteBuffer data, JFAPSegmentType segmentType, UInt16 requestNumber, IoPriority priority, Boolean pooledBufferHint)
   at IBM.XMS.SIB.Comms.Client.JFAPCommunicator.RequestReplyExchange(IByteBuffer data, JFAPSegmentType sendSegType, MessagePriority priority, Boolean canPoolOnReceive)
   at IBM.XMS.SIB.Comms.Client.ConnectionProxy.Close()
   at IBM.XMS.Impl.Connection.Dispose(Boolean disposing)
16:43:31.952--------------------------  Sleeping some before consuming more...
16:43:41.967--------------------------  Connecting...
Exception  : System.InvalidOperationException: UniqueLinkObject no seen on handshake.
   at IBM.XMS.Formats.MFP.SIB.SchemaManager.SendSchemas(ICommsConnection connection, JMFSchema[] schemas)
   at IBM.XMS.Formats.MFP.SIB.JsMsgObject.Encode(Object connection)
FFDC to xmsffdc8416_2013.03.08T10.43.41.967444.txt
Exception  : IBM.XMS.Formats.MFP.MessageEncodeFailedException: Exception of type 'IBM.XMS.Formats.MFP.MessageEncodeFailedException' was thrown. ---> System.InvalidOperationException: UniqueLinkObject no seen on handshake.
   at IBM.XMS.Formats.MFP.SIB.SchemaManager.SendSchemas(ICommsConnection connection, JMFSchema[] schemas)
   at IBM.XMS.Formats.MFP.SIB.JsMsgObject.Encode(Object connection)
   --- End of inner exception stack trace ---
   at IBM.XMS.Formats.MFP.SIB.JsMsgObject.Encode(Object connection)
   at IBM.XMS.Formats.MFP.SIB.TrmFirstContactMessageImpl.Encode(Object connection)
   at IBM.XMS.SIB.Trm.ClientBootstrapHandler.Connect(IClientConnection clientConnection)
FFDC to xmsffdc8416_2013.03.08T10.43.41.983044.txt
16:43:41.983--------------------------  IBM.XMS.XMSException: EXCEPTION_RECEIVED_CWSIA0241
EXCEPTION_RECEIVED_CWSIA0241.explanation
EXCEPTION_RECEIVED_CWSIA0241.useraction
   at IBM.XMS.Impl.ConnectionFactory.CreateConnection(String userName, String password)
   at IBM.XMS.Impl.ConnectionFactory.CreateConnection()
   at SimpleTest.Program.Main(String[] args) in c:\Users\Administrator\Documents\Visual Studio Projects\TestJMSDequeue\SimpleTest\Program.cs:line 26

Linked Exception : IBM.XMS.Core.SIResourceException: CWSIT0006E: It is not possible to connect to bus your_bus_name_here because the following bootstrap servers could not be contacted  1.2.3.4:1234:BootstrapBasicMessaging and the following bootstrap servers returned an error condition . See previous messages for the reason for each bootstrap server failure.
The client cannot connect to the bus. This situation may be due to configuration problems, network problems or it may be that none of the required bootstrap servers or messaging engines are currently available.
Ensure that the network is working correctly and that the required bootstrap servers and messaging engines are available. ---> IBM.XMS.Core.SIConnectionLostException: Exception of type 'IBM.XMS.Core.SIConnectionLostException' was thrown.
   at IBM.XMS.SIB.Comms.Client.ClientSideConnection.Connect(ConnectionProperties cp, IClientComponentHandshake cch, SICoreConnectionProperties siProps)
   at IBM.XMS.SIB.Trm.TrmSICoreConnectionFactoryImpl.Bootstrap(Credentials credentials, SICoreConnectionProperties connectionProperties, ClientAttachProperties cap)
   --- End of inner exception stack trace ---
   at IBM.XMS.SIB.Trm.TrmSICoreConnectionFactoryImpl.Bootstrap(Credentials credentials, SICoreConnectionProperties connectionProperties, ClientAttachProperties cap)
   at IBM.XMS.SIB.Trm.TrmSICoreConnectionFactoryImpl.CreateConnection(Credentials credentials, SICoreConnectionProperties connectionProperties)
   at IBM.XMS.SIB.Trm.TrmSICoreConnectionFactory.CreateConnection(String username, String password, SICoreConnectionProperties connectionProperties)
   at IBM.XMS.Impl.ConnectionFactory.CreateConnection(String userName, String password)
16:43:41.983--------------------------  Sleeping some before consuming more...
16:43:51.998--------------------------  Connecting...
Exception  : System.InvalidOperationException: UniqueLinkObject no seen on handshake.
   at IBM.XMS.Formats.MFP.SIB.SchemaManager.SendSchemas(ICommsConnection connection, JMFSchema[] schemas)
   at IBM.XMS.Formats.MFP.SIB.JsMsgObject.Encode(Object connection)
FFDC to xmsffdc8416_2013.03.08T10.43.51.998262.txt
Exception  : IBM.XMS.Formats.MFP.MessageEncodeFailedException: Exception of type 'IBM.XMS.Formats.MFP.MessageEncodeFailedException' was thrown. ---> System.InvalidOperationException: UniqueLinkObject no seen on handshake.
   at IBM.XMS.Formats.MFP.SIB.SchemaManager.SendSchemas(ICommsConnection connection, JMFSchema[] schemas)
   at IBM.XMS.Formats.MFP.SIB.JsMsgObject.Encode(Object connection)
   --- End of inner exception stack trace ---
   at IBM.XMS.Formats.MFP.SIB.JsMsgObject.Encode(Object connection)
   at IBM.XMS.Formats.MFP.SIB.TrmFirstContactMessageImpl.Encode(Object connection)
   at IBM.XMS.SIB.Trm.ClientBootstrapHandler.Connect(IClientConnection clientConnection)
FFDC to xmsffdc8416_2013.03.08T10.43.51.998262.txt
16:43:51.998--------------------------  IBM.XMS.XMSException: EXCEPTION_RECEIVED_CWSIA0241
EXCEPTION_RECEIVED_CWSIA0241.explanation
EXCEPTION_RECEIVED_CWSIA0241.useraction
   at IBM.XMS.Impl.ConnectionFactory.CreateConnection(String userName, String password)
   at IBM.XMS.Impl.ConnectionFactory.CreateConnection()
   at SimpleTest.Program.Main(String[] args) in c:\Users\Administrator\Documents\Visual Studio Projects\TestJMSDequeue\SimpleTest\Program.cs:line 26

Linked Exception : IBM.XMS.Core.SIResourceException: CWSIT0006E: It is not possible to connect to bus your_bus_name_here because the following bootstrap servers could not be contacted  1.2.3.4:1234:BootstrapBasicMessaging and the following bootstrap servers returned an error condition . See previous messages for the reason for each bootstrap server failure.
The client cannot connect to the bus. This situation may be due to configuration problems, network problems or it may be that none of the required bootstrap servers or messaging engines are currently available.
Ensure that the network is working correctly and that the required bootstrap servers and messaging engines are available. ---> IBM.XMS.Core.SIConnectionLostException: Exception of type 'IBM.XMS.Core.SIConnectionLostException' was thrown.
   at IBM.XMS.SIB.Comms.Client.ClientSideConnection.Connect(ConnectionProperties cp, IClientComponentHandshake cch, SICoreConnectionProperties siProps)
   at IBM.XMS.SIB.Trm.TrmSICoreConnectionFactoryImpl.Bootstrap(Credentials credentials, SICoreConnectionProperties connectionProperties, ClientAttachProperties cap)
   --- End of inner exception stack trace ---
   at IBM.XMS.SIB.Trm.TrmSICoreConnectionFactoryImpl.Bootstrap(Credentials credentials, SICoreConnectionProperties connectionProperties, ClientAttachProperties cap)
   at IBM.XMS.SIB.Trm.TrmSICoreConnectionFactoryImpl.CreateConnection(Credentials credentials, SICoreConnectionProperties connectionProperties)
   at IBM.XMS.SIB.Trm.TrmSICoreConnectionFactory.CreateConnection(String username, String password, SICoreConnectionProperties connectionProperties)
   at IBM.XMS.Impl.ConnectionFactory.CreateConnection(String userName, String password)
16:43:51.998--------------------------  Sleeping some before consuming more...
16:44:02.013--------------------------  Connecting...
Exception  : System.InvalidOperationException: UniqueLinkObject no seen on handshake.
   at IBM.XMS.Formats.MFP.SIB.SchemaManager.SendSchemas(ICommsConnection connection, JMFSchema[] schemas)
   at IBM.XMS.Formats.MFP.SIB.JsMsgObject.Encode(Object connection)
FFDC to xmsffdc8416_2013.03.08T10.44.02.013479.txt
Exception  : IBM.XMS.Formats.MFP.MessageEncodeFailedException: Exception of type 'IBM.XMS.Formats.MFP.MessageEncodeFailedException' was thrown. ---> System.InvalidOperationException: UniqueLinkObject no seen on handshake.
   at IBM.XMS.Formats.MFP.SIB.SchemaManager.SendSchemas(ICommsConnection connection, JMFSchema[] schemas)
   at IBM.XMS.Formats.MFP.SIB.JsMsgObject.Encode(Object connection)
   --- End of inner exception stack trace ---
   at IBM.XMS.Formats.MFP.SIB.JsMsgObject.Encode(Object connection)
   at IBM.XMS.Formats.MFP.SIB.TrmFirstContactMessageImpl.Encode(Object connection)
   at IBM.XMS.SIB.Trm.ClientBootstrapHandler.Connect(IClientConnection clientConnection)
FFDC to xmsffdc8416_2013.03.08T10.44.02.013479.txt
16:44:02.013--------------------------  IBM.XMS.XMSException: EXCEPTION_RECEIVED_CWSIA0241
EXCEPTION_RECEIVED_CWSIA0241.explanation
EXCEPTION_RECEIVED_CWSIA0241.useraction
   at IBM.XMS.Impl.ConnectionFactory.CreateConnection(String userName, String password)
   at IBM.XMS.Impl.ConnectionFactory.CreateConnection()
   at SimpleTest.Program.Main(String[] args) in c:\Users\Administrator\Documents\Visual Studio Projects\TestJMSDequeue\SimpleTest\Program.cs:line 26

Linked Exception : IBM.XMS.Core.SIResourceException: CWSIT0006E: It is not possible to connect to bus your_bus_name_here because the following bootstrap servers could not be contacted  1.2.3.4:1234:BootstrapBasicMessaging and the following bootstrap servers returned an error condition . See previous messages for the reason for each bootstrap server failure.
The client cannot connect to the bus. This situation may be due to configuration problems, network problems or it may be that none of the required bootstrap servers or messaging engines are currently available.
Ensure that the network is working correctly and that the required bootstrap servers and messaging engines are available. ---> IBM.XMS.Core.SIConnectionLostException: Exception of type 'IBM.XMS.Core.SIConnectionLostException' was thrown.
   at IBM.XMS.SIB.Comms.Client.ClientSideConnection.Connect(ConnectionProperties cp, IClientComponentHandshake cch, SICoreConnectionProperties siProps)
   at IBM.XMS.SIB.Trm.TrmSICoreConnectionFactoryImpl.Bootstrap(Credentials credentials, SICoreConnectionProperties connectionProperties, ClientAttachProperties cap)
   --- End of inner exception stack trace ---
   at IBM.XMS.SIB.Trm.TrmSICoreConnectionFactoryImpl.Bootstrap(Credentials credentials, SICoreConnectionProperties connectionProperties, ClientAttachProperties cap)
   at IBM.XMS.SIB.Trm.TrmSICoreConnectionFactoryImpl.CreateConnection(Credentials credentials, SICoreConnectionProperties connectionProperties)
   at IBM.XMS.SIB.Trm.TrmSICoreConnectionFactory.CreateConnection(String username, String password, SICoreConnectionProperties connectionProperties)
   at IBM.XMS.Impl.ConnectionFactory.CreateConnection(String userName, String password)
16:44:02.013--------------------------  Sleeping some before consuming more...

请注意,在上面的输出中,我在“接收...”后不久拔掉了网络,并在 16:43:52 再次插入,但在那之后错误继续存在,直到我终止了程序。

4

2 回答 2

0

当网络再次可用时,它看起来像 ConnectionFactory 没有正确重置它的状态。

我已经在参考手册中搜索了工厂重置功能的任何提示 - 但没有找到。但是我会尝试这个:将GetInstance(...)createConnectionFactory()移出循环以及SetStringProperty()线条。

如果那不起作用,我看不出您的客户为什么不起作用。您是否考虑过这是否是服务器的问题?您拔下哪条以太网电缆?连接到客户端或服务器的那个?如果是服务器,拔掉客户端电缆时会出现同样的问题吗?如果你重新启动程序,它会工作吗?

于 2013-03-22T12:07:42.203 回答
0

我知道这是一个旧帖子,但也许它仍然会有所帮助。

创建 65.535 连接后,您会收到此错误。关闭连接/处置对象都没关系。

我看到以下解决方案:

1.) 您可以创建一次连接,然后将连接重用于队列上的所有操作,直到连接中断。然后你必须重新连接。(是的,这很糟糕并且违反了常见模式。我不建议这样做)

2.) 版本 8.0.0.6 有一个错误修复。编辑:APAR #(IJ01244) 我还不知道它什么时候会包含在未来的版本中。我想您可以联系 IBM 支持并参考此 PMR ID 来接收 IBM.XMS.SIB.dll 的更新版本

希望这可以帮助。

于 2017-12-04T10:55:56.977 回答