Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot IBM MQ忽略由Camel+;基于Spring引导的应用程序_Spring Boot_Apache Camel_Ibm Mq - Fatal编程技术网

Spring boot IBM MQ忽略由Camel+;基于Spring引导的应用程序

Spring boot IBM MQ忽略由Camel+;基于Spring引导的应用程序,spring-boot,apache-camel,ibm-mq,Spring Boot,Apache Camel,Ibm Mq,我们开发了一个基于ApacheCamel JMS组件和Spring Boot的微服务。IBM MQ用作消息传递中间件。异常侦听器存在问题-当与MQ的连接中断时,IBM MQ类无法找到已注册的异常侦听器并在system out中打印它自己的堆栈跟踪: com.ibm.msg.client.jms.internal.JmsProviderExceptionListener The exception is ignored as no exception listener is registered:

我们开发了一个基于ApacheCamel JMS组件和Spring Boot的微服务。IBM MQ用作消息传递中间件。异常侦听器存在问题-当与MQ的连接中断时,IBM MQ类无法找到已注册的异常侦听器并在system out中打印它自己的堆栈跟踪:

com.ibm.msg.client.jms.internal.JmsProviderExceptionListener
The exception is ignored as no exception listener is registered: '
                   Message : com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ1107: A problem with this connection has occurred.
An error has occurred with the IBM MQ JMS connection.
Use the linked exception to determine the cause of this error.
org.springframework.jms.connection.CachingConnectionFactory
用于连接设置

@Bean
protected final ConnectionFactory createMqJmsConnectionFactory() {
    MQQueueConnectionFactory mqFactory = new MQQueueConnectionFactory();
    // Factory setup
    CachingConnectionFactory cachingFactory = new CachingConnectionFactory(mqFactory);    

    return cachingFactory;
}
CachingConnectionFactory
的祖先实现了
javax.jms.ExceptionListener
,正如我在Spring论坛上发现的那样,它将自己注册为ExceptionListener。从堆栈跟踪中,我可以看到在异常之后调用
onException()
方法,重置连接并写入日志

因此,当IBM MQ忽略
CachingConnectionFactory
作为异常侦听器时,就会出现这种情况。Camel JMS组件具有
exceptionListener
endpoint配置选项-我假设在这里添加
CachingConnectionFactory
将是冗余的


要将
CachingConnectionFactory
注册为异常侦听器,需要执行任何其他设置?

尝试在端点配置中添加
exceptionListener
,即使它看起来是冗余的。或者通过调用
cachingFactory.setExceptionListener(cachingFactory)
在上述
@Bean
定义中将对象本身添加为
exceptionListener
。根据您在spring论坛上读到的内容,它可能看起来是多余的,但尝试这样做将确保您的
ExceptionListener
已实际设置,而不是假设。尝试在端点配置中添加
ExceptionListener
,即使它看起来是多余的。或者通过调用
cachingFactory.setExceptionListener(cachingFactory)
在上述
@Bean
定义中将对象本身添加为
exceptionListener
。根据您在spring论坛上所读到的内容,它可能看起来有些多余,但尝试这样做将确保您的
例外侦听器实际上已设置,而不是一个假设。