-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not able to connect to IBm MQ using Springboot with SSl #105
Comments
You are trying to use SSLBundle capability while specifying use of 3.0.2 Spring Boot, but that was only introduced in the 3.1.2 version of this package, |
@ibmmqmet We have changed spring boot version to 3.0.2 now i am getting this error, can you please advise urgently . ====================================================
|
@ibmmqmet , can you please provide updates on this. |
Was this resolved @rmohan17 ? what was the issue? |
Please include the following information in your ticket.
-Although i can connect from main method by directly setting property.
here is the code
Maven FIle:
4.0.0
org.springframework.boot
spring-boot-starter-parent
3.2.1
com.optum.eems
eems-ibm-mq-app
0.0.1-SNAPSHOT
eems-ibm-mq-app
eems-ibm-mq-app
<java.version>17</java.version>
org.springframework.boot
spring-boot-starter-web
package com.optum.eems.eemsibmmqapp;
import com.ibm.mq.jakarta.jms.MQConnectionFactory;
import com.ibm.mq.spring.boot.MQConnectionFactoryCustomizer;
import jakarta.jms.Message;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.jms.connection.JmsTransactionManager;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import java.util.Date;
@SpringBootApplication
@EnableJms
@EnableTransactionManagement
public class EemsIbmMqAppApplication {
}
ibm.mq.channel=GW_SECCLNT
ibm.mq.connName=wmqrt0013.uhc.com(50001)
ibm.mq.user=eeemqtst
ibm.mq.password=afsafs
ibm.mq.sslCipherSpec=ANY_TLS12_OR_HIGHER
ibm.mq.sslBundle=ibmmq
spring.jms.cache.enabled=true
spring.ssl.bundle.jks.ibmmq.truststore.location=./certs/standard_trusts.jks
spring.ssl.bundle.jks.ibmmq.truststore.password=asffs
spring.ssl.bundle.jks.ibmmq.truststore.type=JKS
spring.ssl.bundle.jks.ibmmq.keystore.location=./certs/eee_key.jks
spring.ssl.bundle.jks.ibmmq.keystore.password=dhjasdh
spring.ssl.bundle.jks.ibmmq.keystore.type=JKS
Error i am getting.
2024-01-03T16:50:28.768-05:00 INFO 8024 --- [ main] c.o.e.e.EemsIbmMqAppApplication : Starting EemsIbmMqAppApplication using Java 21.0.1 with PID 8024 (/Users/rmohan30/Desktop/github/cp/mq/eems-ibm-mq-app/target/classes started by rmohan30 in /Users/rmohan30/Desktop/github/cp/mq/eems-ibm-mq-app)
2024-01-03T16:50:28.769-05:00 INFO 8024 --- [ main] c.o.e.e.EemsIbmMqAppApplication : No active profile set, falling back to 1 default profile: "default"
2024-01-03T16:50:29.185-05:00 INFO 8024 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
2024-01-03T16:50:29.189-05:00 INFO 8024 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-01-03T16:50:29.189-05:00 INFO 8024 --- [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.17]
2024-01-03T16:50:29.211-05:00 INFO 8024 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-01-03T16:50:29.211-05:00 INFO 8024 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 422 ms
====================================================
MQ JMS Transaction Sample with JMS3 and TLS started.
Exception in thread "main" org.springframework.transaction.CannotCreateTransactionException: Could not create JMS transaction
at org.springframework.jms.connection.JmsTransactionManager.doBegin(JmsTransactionManager.java:255)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.startTransaction(AbstractPlatformTransactionManager.java:531)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:405)
at com.optum.eems.eemsibmmqapp.EemsIbmMqAppApplication.main(EemsIbmMqAppApplication.java:56)
Caused by: com.ibm.msg.client.jakarta.jms.DetailedJMSException: JMSWMQ0018: Failed to connect to queue manager 'WMQS102' with connection mode 'Client' and host name 'Client'.
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.
at com.ibm.msg.client.jakarta.wmq.common.internal.Reason.reasonToException(Reason.java:595)
at com.ibm.msg.client.jakarta.wmq.common.internal.Reason.createException(Reason.java:215)
at com.ibm.msg.client.jakarta.wmq.internal.WMQConnection.(WMQConnection.java:458)
at com.ibm.msg.client.jakarta.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:8683)
at com.ibm.msg.client.jakarta.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:8023)
at com.ibm.msg.client.jakarta.jms.admin.JmsConnectionFactoryImpl._createConnection(JmsConnectionFactoryImpl.java:322)
at com.ibm.msg.client.jakarta.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:242)
at com.ibm.mq.jakarta.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6026)
at com.ibm.mq.jakarta.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:6055)
at org.springframework.jms.connection.SingleConnectionFactory.doCreateConnection(SingleConnectionFactory.java:452)
at org.springframework.jms.connection.SingleConnectionFactory.initConnection(SingleConnectionFactory.java:414)
at org.springframework.jms.connection.SingleConnectionFactory.getConnection(SingleConnectionFactory.java:328)
at org.springframework.jms.connection.SingleConnectionFactory.createConnection(SingleConnectionFactory.java:243)
at org.springframework.jms.connection.JmsTransactionManager.createConnection(JmsTransactionManager.java:330)
at org.springframework.jms.connection.JmsTransactionManager.doBegin(JmsTransactionManager.java:223)
... 3 more
Caused by: com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2397' ('MQRC_JSSE_ERROR').
at com.ibm.msg.client.jakarta.wmq.common.internal.Reason.createException(Reason.java:203)
... 16 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2397;AMQ9204: Connection to host 'wmqrt0013.uhc.com(50001)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2397;AMQ9771: SSL handshake failed. [1=javax.net.ssl.SSLHandshakeException[PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target],3=wmqrt0013.uhc.com/10.86.36.32:50001 (wmqrt0013.uhc.com),4=SSLSocket.startHandshake,5=default]],3=wmqrt0013.uhc.com(50001),4=,5=RemoteTCPConnection.protocolConnect]
at com.ibm.mq.jmqi.remote.api.RemoteFAP$Connector.jmqiConnect(RemoteFAP.java:13670)
at com.ibm.mq.jmqi.remote.api.RemoteFAP$Connector.access$100(RemoteFAP.java:13202)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1451)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1392)
at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:377)
at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:562)
at com.ibm.msg.client.jakarta.wmq.internal.WMQConnection.(WMQConnection.java:391)
... 15 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2397;AMQ9771: SSL handshake failed. [1=javax.net.ssl.SSLHandshakeException[PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target],3=wmqrt0013.uhc.com/10.86.36.32:50001 (wmqrt0013.uhc.com),4=SSLSocket.startHandshake,5=default]
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1585)
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:1013)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getNewConnection(RemoteConnectionSpecification.java:691)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:283)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:170)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:128)
at com.ibm.mq.jmqi.remote.api.RemoteFAP$Connector.jmqiConnect(RemoteFAP.java:13402)
... 21 more
Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:130)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:378)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:316)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1318)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(CertificateMessage.java:1195)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(CertificateMessage.java:1138)
at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:393)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:476)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:447)
at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:201)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:172)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1506)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1421)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426)
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$6.run(RemoteTCPConnection.java:1552)
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$6.run(RemoteTCPConnection.java:1544)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1544)
... 27 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:388)
at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:271)
at java.base/sun.security.validator.Validator.validate(Validator.java:256)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:230)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:132)
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1302)
... 42 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:148)
at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:129)
at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:383)
... 47 more
The text was updated successfully, but these errors were encountered: