I have WebSphere MQ and WebSphere Message Broker installed on Linux and when I execute mqsicreateexecutiongroup
I get an error saying:
BIP1046E: Unable to connect with the queue manager (Could not connect to queue manager ‘NSPZPAI1’ (MQ reason code 2538)).
When I search for this reason code I understand that it is a host not available error.
Can somebody please tell me how to resolve this error?
When I run a runmqlsr
command I always end up in a hang. Can somebody tell me how to start a listener?
T.Rob
31.4k9 gold badges59 silver badges101 bronze badges
asked Oct 16, 2012 at 9:34
Don’t start the listener by hand or script. If you have a modern queue manager, define a listener object like so:
DEF LISTENER(LISTENER.1414) TRPTYPE(TCP) +
CONTROL(QMGR) PORT(1414) +
REPLACE
START LISTENER(LISTENER.1414)
The attribute CONTROL(QMGR)
tells the QMgr to start the listener automatically when the QMgr is started and to kill the listener when the QMgr is shut down. This ensures that the listener will always be started when the QMgr comes up, even if the QMgr is started manually instead of from the usual boot script. Because the listener is a child process of the QMgr it will always come down with the QMgr so you don’t need to worry about orphaned listeners preventing connections after a QMgr restart.
Once the listener is defined, you can also use START LISTENER
or STOP LISTENER
MQSC commands to manually start and stop it independently of the QMgr. In the example above, I’ve manually started the listener rather than reboot the QMgr. Either would work but the START
command is less intrusive.
answered Oct 16, 2012 at 13:19
T.RobT.Rob
31.4k9 gold badges59 silver badges101 bronze badges
1
Listener is run using
runmqlsr -t tcp -p <port> -m <queue manager name>.
It starts the listener which waits for connections. More details on the command are here
answered Oct 16, 2012 at 10:26
ShashiShashi
14.9k2 gold badges32 silver badges50 bronze badges
Environment:.NET 4.0, MQ.NET client IBm.xMS (V2.0.0.3)
The test code is as follows:
var factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); var _connFactory = factoryFactory.CreateConnectionFactory(); _connFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, "192.168.0.65"); _connFactory.SetIntProperty(XMSC.WMQ_PORT, 1414); _connFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "XPP_QM"); _connFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); _connFactory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V1); _connFactory.SetStringProperty(XMSC.CLIENT_ID, string.Empty); var conn = _connFactory.CreateConnection(); conn.Start();
Error:
IBM. XMS. XMSException: CWSMQ0006E: method is called ConnectionFactory. Abnormal received during the CreateConnection: CompCode: 2, Reason: 2538
. During the execution of the specified method, another component throws an exception. For more information, see Linked Exceptions. .
in the IBM XMS. Client. WMQ. WmqConnectionFactory. CreateProviderConnection (XmsPropertyContext connectionProps)
in the IBM, XMS. Client. Impl. XmsConnectionFactoryImpl. The CreateConnection (String userID. String password)
in the IBM, XMS. Client. Impl. XmsConnectionFactoryImpl. The CreateConnection ()
in XRisk. MQ. MQConnection. Open (Boolean needLog) location e: xRisk4 – SRC XRisk MQ MQConnection cs: line number 314
Linked Exception : CompCode: 2, Reason: 2538
The real exception is reported in the following code.
IBM.WMQ.MQTCPConnection ---- < ParseLocalAddress(String) exit [o] rc=OK IBM.WMQ.MQTCPConnection --- d Exception in method ConnectSocket(string,string,MQLONG) IBM.WMQ.MQTCPConnection --- X System.Net.Sockets.SocketException (0x80004005): The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for at System.Net.Dns.InternalGetHostByAddress(IPAddress address, Boolean includeIPv6) at System.Net.Dns.GetHostEntry(String hostNameOrAddress) at IBM.WMQ.MQTCPConnection.ConnectSocket(String localAddr, String connectionName, Int32 options) MQException CompCode: 2 Reason: 2538
The real reason is that in.NET 4.0, Microsoft changed the behavior of the interface Dns.GetHostEntry. When IP is used directly as a parameter, the report is not reported if the machine name or domain name is used.
The solution is as follows
1. Use ipAddres.tryparse () or Dns.Resolve(String) instead of Dns.GetHostEntry.
2. If you are using a third-party library and cannot modify the code, you can use the MACHINE name or domain name code for the IP. The above code can be changed to.
var factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); var _connFactory = factoryFactory.CreateConnectionFactory(); _connFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, "hostname"); _connFactory.SetIntProperty(XMSC.WMQ_PORT, 1414); _connFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "XPP_QM"); _connFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); _connFactory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V1); _connFactory.SetStringProperty(XMSC.CLIENT_ID, string.Empty); var conn = _connFactory.CreateConnection(); conn.Start();
Reference:
http://connect.microsoft.com/VisualStudio/feedback/details/561083/dns-gethostentry-behaves-differently-in-net-4-0-than-previous-versions
http://stackoverflow.com/questions/2714449/problem-with-system-net-dns-gethostentrydnsserver-on-net-4-0
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014538533#77777777-0000-0000-0000-000014538832
Reproduced in: https://www.cnblogs.com/jmax/p/3494320.html
- Remove From My Forums
-
Question
-
Hi,
I am trying to read message from Queue using MQSC in BizTalk 2013 R2 and I am getting connection issues.. below are the server version details.
I am able to telnet to the MQ server but bizTalk is throwing error. MQ listener is running as BizTalk 2010 with the same MQ Client version is able to connect and read the messages.BizTalk Version : 2013 R2
HIS : 2013
MQ Client : 7.5.0.5
Error :
The adapter «MQSC» raised an error message. Details «Failure encountered while attempting to open queue. queue = ****, queueManager
= ****, reasonCode = 2538».Remote host ‘***’ not available, retry later.
The attempt to allocate a conversation using TCP/IP to host ‘***’ for channel **** was not successful. However the error may be a transitory one and it may be possible to successfully allocate a TCP/IP conversation later. &P In some cases
the remote host cannot be determined and so is shown as ‘????’.Actions Taken
Reinstalled MQ , Repaired HIS , Verified COM + components are registered correctly and Telnet to the MQ is working.. Also verified and verified that the connection details are correct
-Dheer
-
Edited by
Thursday, February 18, 2016 5:36 PM
.
-
Edited by
Answers
-
thanks for the reply .. It was odd but found that i need to use Fully qualified name for the connection name .. We never did it in the 2010 servers .. may be because our new servers
are in Azure we have an issue but in any case my issue is resolved and I asked the network team to check why the name is not auto resolved…. Thanks for the help..
-Dheer
-
Marked as answer by
Dheer R
Thursday, February 18, 2016 7:26 PM -
Edited by
Dheer R
Thursday, February 18, 2016 7:27 PM
.
-
Marked as answer by
If I try using «MQ Docker container for developers», I am getting exactly same issue as that mentioned by james-r-smith on April 9th 2019 in my spring boot code. Any idea how this issues was solved/closed ? I am stuck totally..
I am running MQ on docker within Ububtu in VMbox. Here is the docker command I used —
sudo docker run --env LICENSE=accept --env MQ_QMGR_NAME=QM1 --publish 1414:1414 --publish 9443:9443 --detach ibmcom/mq
I get below error, when I try to put message using simple spring boot app ->
com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode ‘2’ (‘MQCC_FAILED’) reason ‘2538’ (‘MQRC_HOST_NOT_AVAILABLE’)
Just a quick note : — I checked that Que manager is working fine on https://localhost:9443/ibmmq/console/
vinay@vinay-VirtualBox:~$ sudo docker run -p 8084:8084 mqspring
. ____ _ __ _ _
/ / ‘ __ _ () __ __ _
( ( )__ | ‘_ | ‘| | ‘ / ` |
/ )| |)| | | | | || (| | ) ) ) )
‘ || .__|| ||| |_, | / / / /
=========||==============|/=////
:: Spring Boot :: (v2.2.6.RELEASE)
2020-03-27 15:29:22.429 INFO 1 — [ main] c.example.mqspring.MqspringApplication : Starting MqspringApplication v0.0.1-SNAPSHOT on 59c59e3c5ce5 with PID 1 (/mqspring-0.0.1-SNAPSHOT.jar started by root in /)
2020-03-27 15:29:22.434 INFO 1 — [ main] c.example.mqspring.MqspringApplication : No active profile set, falling back to default profiles: default
2020-03-27 15:29:26.366 INFO 1 — [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8084 (http)
2020-03-27 15:29:26.437 INFO 1 — [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-03-27 15:29:26.438 INFO 1 — [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.33]
2020-03-27 15:29:26.703 INFO 1 — [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-03-27 15:29:26.704 INFO 1 — [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4024 ms
2020-03-27 15:29:28.834 INFO 1 — [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService ‘applicationTaskExecutor’
2020-03-27 15:29:29.523 INFO 1 — [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8084 (http) with context path »
2020-03-27 15:29:29.532 INFO 1 — [ main] c.example.mqspring.MqspringApplication : Started MqspringApplication in 8.263 seconds (JVM running for 9.95)
2020-03-27 15:30:16.388 INFO 1 — [nio-8084-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet ‘dispatcherServlet’
2020-03-27 15:30:16.388 INFO 1 — [nio-8084-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet ‘dispatcherServlet’
2020-03-27 15:30:16.415 INFO 1 — [nio-8084-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 27 ms
org.springframework.jms.IllegalStateException: JMSWMQ0018: Failed to connect to queue manager ‘QM1’ with connection mode ‘Client’ and host name ‘localhost(1414)’.; nested exception is com.ibm.msg.client.jms.DetailedIllegalStateException: JMSWMQ0018: Failed to connect to queue manager ‘QM1’ with connection mode ‘Client’ and host name ‘localhost(1414)’.
Check the queue manager is started and if running in client mode, check there is a listener running. Please see the linked exception for more information.; nested exception is com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode ‘2’ (‘MQCC_FAILED’) reason ‘2538’ (‘MQRC_HOST_NOT_AVAILABLE’).
at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:274)
at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:185)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:507)
Having simple Spring Boot application — with below POM ->
`
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.2.6.RELEASE
com.example
mqspring
0.0.1-SNAPSHOT
mqspring
Demo project for Spring Boot
<properties>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>mq-jms-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
`
Having following in the properties file ->
server.port=8084 ibm.mq.queueManager=QM1 ibm.mq.channel=DEV.ADMIN.SVRCONN ibm.mq.connName=localhost(1414) ibm.mq.user=admin ibm.mq.password=passw0rd
Я новичок в IBM Websphere MQ
Я пытаюсь добавить сообщения в удаленный администратор очередей websphere MQ. Я получаю следующую ошибку при попытке подключиться к нему.
Кроме того, я пробовал много возможных решений, представленных на форумах, таких как изменение .net framework на 3.5, также я получаю хороший пинг, когда я пингую удаленный компьютер, но я не могу подключиться к нему с помощью кода C #. Прослушиватель диспетчера очередей запущен и работает, но я получаю эту ошибку
2538 — MQRC_HOST_NOT_AVAILABLE
пока пытаешься это сделать.
queueManager = new MQQueueManager();
Я использую .NET framework 4.5. Любая помощь будет оценена.
MQRC_HOST_NOT_AVAILABLE
может означать, что ваш клиент не может найти диспетчер очереди, который вы ему поручили искать. Учитывая, что вы сказали, что ваш код
queueManager = новый MQQueueManager ();
Я подозреваю, что вы не сообщили своему .NET несколько ключевых фрагментов информации, которые ему необходимо знать, чтобы иметь возможность найти диспетчер очереди. Чтобы подключить клиент MQ к диспетчеру очередей, он должен знать
- канал для подключения
- Имя хоста машины, на которой запущен диспетчер очереди
- Порт, на котором работает администратор очередей
Для .NET они могут быть предоставлены разными способами, которые подробно описаны в документации центра знаний по классу MQQueueManager.
На этой странице в примере кода для подключения к диспетчеру очередей говорится:
MQEnvironment.hostname = «fred.mq.com»; // хост для подключения
MQEnvironment.port = -1; // порт для подключения. Если не задан, по умолчанию используется значение 1414 для клиентских подключений WebSphereMQ.
MQEnvironment.channel = «channel.name»; // Чувствительное к регистру имя канала SVRCONN в диспетчере очередей
MQQueueManager qMgr = новый MQQueueManager («MYQM»);
Также обратите внимание, что вызов для создания MQQueueManager также принимает параметр, который является именем подключенного диспетчера очереди.
Убедитесь, что вы предоставляете всю необходимую информацию, которая необходима клиенту для подключения, включая имя администратора очередей. Если он все еще не работает, проверьте журналы диспетчера очереди на наличие сообщений об ошибках (если их нет, клиент действительно не получает доступ к диспетчеру очереди, в противном случае в сообщении об ошибке будет указано, почему диспетчер очереди не отвечает).
Пожалуйста, не используйте класс MQEnvironment, так как он не является потокобезопасным. Гораздо лучше поместить всю информацию в Hashtable и передать Hashtable в класс MQQueueManager. Вот пример управляемого режима MQ .NET с использованием хеш-таблицы для информации о подключении MQ:
using System; using System.Collections; using System.Collections.Generic; using System.Text; using IBM.WMQ; namespace MQTest02 { class MQTest02 { private Hashtable inParms = null; private Hashtable qMgrProp = null; private System.String qManager; private System.String outputQName; /* * The constructor */ public MQTest02() : base() { } /// Make sure the required parameters are present. /// true/false /// private bool allParamsPresent() { bool b = inParms.ContainsKey('-h') && inParms.ContainsKey('-p') && inParms.ContainsKey('-c') && inParms.ContainsKey('-m') && inParms.ContainsKey('-q'); if (b) { try { System.Int32.Parse((System.String)inParms['-p']); } catch (System.FormatException e) { b = false; } } return b; } /// Extract the command-line parameters and initialize the MQ variables. /// /// /// IllegalArgumentException private void init(System.String[] args) { inParms = Hashtable.Synchronized(new Hashtable()); if (args.Length > 0 && (args.Length % 2) == 0) { for (int i = 0; i < args.Length; i += 2) { inParms[args[i]] = args[i + 1]; } } else { throw new System.ArgumentException(); } if (allParamsPresent()) { qManager = ((System.String)inParms['-m']); outputQName = ((System.String)inParms['-q']); qMgrProp = new Hashtable(); qMgrProp.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED); qMgrProp.Add(MQC.HOST_NAME_PROPERTY, ((System.String)inParms['-h'])); qMgrProp.Add(MQC.CHANNEL_PROPERTY, ((System.String)inParms['-c'])); try { qMgrProp.Add(MQC.PORT_PROPERTY, System.Int32.Parse((System.String)inParms['-p'])); } catch (System.FormatException e) { qMgrProp.Add(MQC.PORT_PROPERTY, 1414); } if (inParms.ContainsKey('-u')) qMgrProp.Add(MQC.USER_ID_PROPERTY, ((System.String)inParms['-u'])); if (inParms.ContainsKey('-x')) qMgrProp.Add(MQC.PASSWORD_PROPERTY, ((System.String)inParms['-x'])); if (inParms.ContainsKey('-s')) qMgrProp.Add(MQC.SECURITY_EXIT_PROPERTY, ((System.String)inParms['-s'])); System.Console.Out.WriteLine('MQTest02:'); Console.WriteLine(' QMgrName ='{0}'', qManager); Console.WriteLine(' Output QName ='{0}'', outputQName); System.Console.Out.WriteLine('QMgr Property values:'); foreach (DictionaryEntry de in qMgrProp) { Console.WriteLine(' {0} = '{1}'', de.Key, de.Value); } } else { throw new System.ArgumentException(); } } /// Connect, open queue, read a message, close queue and disconnect. /// /// /// MQException private void testReceive() { MQQueueManager qMgr = null; MQQueue queue = null; int openOptions = MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING; MQGetMessageOptions gmo = new MQGetMessageOptions(); MQMessage receiveMsg = null; try { qMgr = new MQQueueManager(qManager, qMgrProp); System.Console.Out.WriteLine('MQTest02 successfully connected to ' + qManager); queue = qMgr.AccessQueue(outputQName, openOptions, null, null, null); // no alternate user id System.Console.Out.WriteLine('MQTest02 successfully opened ' + outputQName); receiveMsg = new MQMessage(); queue.Get(receiveMsg, gmo); System.Console.Out.WriteLine('Message Data>>>' + receiveMsg.ReadString(receiveMsg.MessageLength)); } catch (MQException mqex) { System.Console.Out.WriteLine('MQTest02 cc=' + mqex.CompletionCode + ' : rc=' + mqex.ReasonCode); } catch (System.IO.IOException ioex) { System.Console.Out.WriteLine('MQTest02 ioex=' + ioex); } finally { try { queue.Close(); System.Console.Out.WriteLine('MQTest02 closed: ' + outputQName); } catch (MQException mqex) { System.Console.Out.WriteLine('MQTest02 cc=' + mqex.CompletionCode + ' : rc=' + mqex.ReasonCode); } try { qMgr.Disconnect(); System.Console.Out.WriteLine('MQTest02 disconnected from ' + qManager); } catch (MQException mqex) { System.Console.Out.WriteLine('MQTest02 cc=' + mqex.CompletionCode + ' : rc=' + mqex.ReasonCode); } } } /// main line /// /// // [STAThread] public static void Main(System.String[] args) { MQTest02 mqt = new MQTest02(); try { mqt.init(args); mqt.testReceive(); } catch (System.ArgumentException e) { System.Console.Out.WriteLine('Usage: MQTest02 -h host -p port -c channel -m QueueManagerName -q QueueName [-u userID] [-x passwd] [-s securityExit]'); System.Environment.Exit(1); } catch (MQException e) { System.Console.Out.WriteLine(e); System.Environment.Exit(1); } System.Environment.Exit(0); } } }
Описание проблемы:
O / S: 7.3, версия MQ: 8.0.0.5. Сервер находится в анклаве.
Существует администратор очередей с каналом подключения к серверу с именем
CL_IR360. Пользователь пытается подключиться к нему, но это не удается
с ошибкой ниже.
Пользователь получает сообщение об ошибке:
- Ошибка тестового подключения
- Соединение с хостом «IP-адрес (порт)» отклонено
- JmqiException CC = 2 RC = 2538 AMQ9213
- Произошла ошибка связи для TCP
- java.net.SocketTimeoutException — время ожидания подключения истекло
- Подключение к IP-адресу (порту) хоста отклонено
- MQxx HOST НЕДОСТУПЕН 2538
Вышеупомянутая ошибка в этом конкретном случае была связана с тем, что для канала подключения к серверу не было установлено прав доступа (SET CHLAUTH). Добавлены права доступа к каналу, и ошибка устранена.
- 1 Вопрос касался .net, а не java. У вас есть вся указанная выше информация, чтобы задать свой вопрос, а затем самому ответить на него, вероятно, это лучшее место для этой информации.
Tweet
Share
Link
Plus
Send
Send
Pin
Вопрос:
Я использую версию IBM WebSphere MQ 8.0.
Я сконфигурировал один из моих каналов с помощью шифрования Cipher Specification TLS_RSA_WITH_AES_256_CBC_SHA256 вместе с действительными сертификатами, установленными и правильно настроенными на путь хранения ключей.
Мой клиентский код.NET не может подключиться к этому защищенному каналу. Он дает ошибку 2538 непрерывно. У меня есть другой канал, настроенный без шифрования (необеспеченный). Клиентский код может подключаться к этому каналу без каких-либо ошибок.
Это мой клиентский код.NET:
Hashtable queueProperties = new Hashtable();
queueProperties[MQC.HOST_NAME_PROPERTY] = host; // IP address
queueProperties[MQC.PORT_PROPERTY] = 1541
queueProperties[MQC.CHANNEL_PROPERTY] = channel; // channel name
queueProperties[MQC.TRANSPORT_PROPERTY] = MQC.TRANSPORT_MQSERIES_MANAGED;
queueProperties[MQC.SSL_CERT_STORE_PROPERTY] = "*USER";
queueProperties[MQC.SSL_CIPHER_SPEC_PROPERTY] = "TLS_RSA_WITH_AES_256_CBC_SHA256";
queueProperties[MQC.SSL_PEER_NAME_PROPERTY] = "CN=FXCMTST1,O=IBM,C=US";
queueProperties["CertificateLabel"] = "ibmwebspheremqfxcmtst1";
queueProperties[MQC.KEY_RESET_COUNT] = 0;
MQEnvironment.SSLCertRevocationCheck = true;
queueProperties[MQC.USER_ID_PROPERTY] = user; // variable
queueProperties[MQC.PASSWORD_PROPERTY] = pwd; // variable
try
{
// Attempt the connection
queueManager = new MQQueueManager(qmgr, queueProperties);
strReturn = "Connected Successfully";
}
Я также установил для пользователя MCA действительного пользователя со всеми необходимыми правами доступа.
Вышеприведенный код отлично работает для незащищенного канала, когда я удаляю эти строки и заменяю имя канала на необеспеченный.
queueProperties[MQC.TRANSPORT_PROPERTY] = MQC.TRANSPORT_MQSERIES_MANAGED;
queueProperties[MQC.SSL_CERT_STORE_PROPERTY] = "*USER";
queueProperties[MQC.SSL_CIPHER_SPEC_PROPERTY] = "TLS_RSA_WITH_AES_256_CBC_SHA256";
queueProperties[MQC.SSL_PEER_NAME_PROPERTY] = "CN=FXCMTST1,O=IBM,C=US";
queueProperties["CertificateLabel"] = "ibmwebspheremqfxcmtst1";
queueProperties[MQC.KEY_RESET_COUNT] = 0;
MQEnvironment.SSLCertRevocationCheck = true;
Я что-то пропустил в конфигурации кода или MQ?
ОБНОВЛЕНИЕ 1: Я обнаружил, что ошибка связана с неправильным доступом к базе данных ключей. Я упомянул путь до имени папки, где были размещены сертификаты. Однако, как ожидается, это имя папки, за которой следует имя файла kdb без расширения.
После этого изменения ошибка 2538 исчезла. Но теперь я получаю ошибку 2059 с сообщением об ошибке ниже в журнале.
“CipherSpec, согласованный во время установления связи SSL, не соответствует требуемому CipherSpec для канала…”
Мой канал настроен на наличие “TLS_RSA_WITH_AES_256_CBC_SHA256”, как я установил в MQ Explorer. Клиентский код также отправляет одну и ту же спецификацию шифрования. Тем не менее он дает ошибку 2059.
ОБНОВЛЕНИЕ 2: Как было предложено @JoshMc, я установил групповую политику и устранил ошибку выше. Затем я начал получать ошибку “Отсутствует сертификат канала”.
ОБНОВЛЕНИЕ 3: Эта ошибка исчезла после того, как я сменил SSLCAUTH на OPTIONAL. Раньше он был установлен в ТРЕБУЕТСЯ. Спасибо @JoshMc за указание.
Лучший ответ:
Первоначально в вашем вопросе у вас была следующая строка кода:
queueProperties[MQC.SSL_PEER_NAME_PROPERTY] = "ibmwebspheremqtestqueue";
Я посоветовал: SSL_PEER_NAME_PROPERTY
предназначен для проверки части или всего значения DN для сертификата диспетчера очереди, поэтому он будет иметь формат CN=x.domain.com,OU=Y,O=Company Inc
, то, что вы выглядят как ярлык cert.
Вы видите, какие ошибки генерируются, если они есть в менеджерах очереди AMQERR01.LOG? Как насчет локального клиента AMQERR01.LOG?
Вы ответили с ошибкой диспетчера очереди:
AMQ9660: SSL key repository: password stash file absent or unusable.
И вы нашли ошибку за каждое обновление:
UPDATE: Я обнаружил, что ошибка связана с неправильным доступом к базе данных ключей. Я упомянул путь до имени папки, где были размещены сертификаты. Однако, как ожидается, это имя папки, за которой следует имя файла kdb без расширения.
Теперь вы перешли к следующей ошибке:
The CipherSpec negotiated during the SSL handshake does not match the required CipherSpec for channel...
Я посоветовал: Управляемый.net не использует указанный вами шифр, он выбран из политики Windows. Этот вопрос и ответ должны помочь ” IBM MQ.Net CertificateLabel, CipherSpec “.
Вы сообщили, что исправили групповую политику, а затем перешли к следующей ошибке при установке SSLCAUTH(REQUIRED)
на канале SVRCONN
:
channel is lacking a certificate
SSLCAUTH(REQUIRED)
сообщает менеджеру очереди, что вы SSLCAUTH(REQUIRED)
, чтобы клиент имел сертификат. Клиент всегда будет требовать, чтобы диспетчер очереди имел сертификат независимо от того, для чего SSLCAUTH
.
Предполагая, что диспетчер очереди настроен на выполнение CONNAUTH
для проверки пользователя и пароля, которые вы отправляете, и вы установили ADOPTCTX(YES)
в CONNAUTH
AUTHINFO
, тогда наличие SSLCAUTH(OPTIONAL)
является разумной настройкой, так как это означает, что все данные между клиент и диспетчер очереди будут зашифрованы, а соединение будет аутентифицировано id/pw. Даже если у вас есть SSLCAUTH(REQUIRED)
, если вы также настроить SVRCONN
в соответствии с конкретным DN
значение либо через канал SSLPEER
собственности или CHLAUTH TYPE(SSLPEERMAP)
правило SSLPEER
собственности оно не предоставляет какой – либо форме аутентификации.
We have two connections (as a .NET/Windows client) to an IBM MQ endpoint (let’s say non-Windows).
We use SSL, which is supported by a pair of certificates (client and server) and correctly labelled in the Windows Certificate Store to ensure we pick the right certificate.
Everything in Queue A works fine.
Queue B has recently stopped working. We now get a 2538 error. Nothing has changed.
- We keep both sides of both queues the same as we can.
- We have Wire-traced both Queue A and Queue B and can confirm SSL negotiation is incomplete on Queue B because of a «Connection Reset» by the Client
- All certificates are valid and in date
- We’ve tried with hard-trusted Self-signed certs between parties
It feels like there may be a communication error inhibiting successful SSL handshake.
The problem is exacerbated by the WebSphereMqClient
NuGet package we use (8.0.0.7 — latest version) not giving us anything other than a 2538 error on calling:
_mqQueueManager = new MQQueueManager((string)queueManager, (Hashtable)connectionProperties);
Connection Properties being (redacted):
<IbmMqConnection server="ipaddress"
portNumber="1234"
channel="SOME.CHANNEL"
queueManager="QUEUE_MANAGER">
<SecureConnection enabled="True"
cipherSuite="TLS_RSA_WITH_AES_256_CBC_SHA256"
cipherSpec="TLS_RSA_WITH_AES_256_CBC_SHA256"
peerName="CN=trusted-parties-cn"
certificateLabel="ibmwebspheremq"
/>
Is there anything an expert could give us a clue on? Is there a way to get any diagnostics out of the NuGet black box?
Update 1:
The server is running 8.0.0.9.
Update 2:
@JoshMc suggested I turn on logging.
From this, I learn:
- It couldn’t (rightly) find an
mqclient.ini
file in the binary folder or my personal folder. - Errors start during SSL Authentication, specifically
System.ComponentModel.Win32Exception (0x80004005): The credentials supplied to the package were not recognized
- Followed by the host seemingly disappearing:
MQTCPConnection.ConnectSocket(string,string,MQLONG) rc=OK
00000174 10:29:28.917526 5748.1 CompCode: 2, Reason: 2538
AMQ9202: Remote host 'x.x.x.x(y)' not available, retry later. - Out of which comes the 2538
CompCode: 2, Reason: 2538
- Negotiation seems to continue, using appropriate TLS version, etc.
- Then when trying to get the client (with our private key) certificate, we get
System.ComponentModel.Win32Exception (0x80004005): The credentials supplied to the package were not recognized
I have double checked that the user does have permission to the Private Key.
Update 3
Issue found.
The issue was highlighted by the text System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
. On investigation it turns out that the permissions on the Private Key had been removed during a certificate renewal. I know the above says the permissions were confirmed to be there, but for a different certificate. I’ve left it in to retain history/honesty.