【发布时间】:2022-01-25 00:15:57
【问题描述】:
假设:TestContainer 作为集成框架,Spring Boot 应用程序,ibm mq 作为代理我尝试测试它,无法使用默认设置连接,catch:
Caused by: com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2538' ('MQRC_HOST_NOT_AVAILABLE').
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)
... 118 common frames omitted
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9204: Connection to host 'localhost(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2538;AMQ9204: Connection to host 'localhost/127.0.0.1:1414' rejected. [1=java.net.ConnectException[Connection refused (Connection refused)],3=localhost/127.0.0.1:1414,4=TCP,5=Socket.connect]],3=localhost(1414),4=,5=RemoteTCPConnection.bindAndConnectSocket]
容器声明:
@Container
static GenericContainer<?> mqContainer = new GenericContainer<>(DockerImageName.parse("ibmcom/mq"))
.withEnv("LICENSE", "accept")
.withEnv("MQ_QMGR_NAME", "QM1")
.withEnv("MQ_USER_NAME","admin")
.withCommand("--volume q1data:/mnt/mqm")
.withExposedPorts(1414);```
yml 文件中队列的所有设置看起来都不相关,因为没有任何端口特定的东西:
ibm:
mq:
channel: DEV.APP.SVRCONN
queue-manager: QM1
user: admin
password: passw0rd
use-i-b-m-cipher-mappings: false
user-authentication-m-q-c-s-p: false
#ssl-cipher-spec: ECDHE_RSA_AES_128_CBC_SHA256
ssl.enabled: false
我询问了 TC 框架支持者,他们建议在动态属性中为 spring 设置主机和端口,这似乎是合法的。我找不到要使用的正确设置的唯一问题。有什么建议吗?
【问题讨论】:
标签: ibm-mq testcontainers