英文:
Migrating Spring Boot 2.7.0 to 3.0.2, Am facing issue ( jakarta.jms.ConnectionFactory cannot be typecast to com.ibm.mq.jms.MQConnectionFactory)
问题
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.jms.core.JmsTemplate]: Factory method 'jmsTemplate' threw exception with message: class com.ibm.mq.jms.MQConnectionFactory cannot be cast to class jakarta.jms.ConnectionFactory (com.ibm.mq.jms.MQConnectionFactory and jakarta.jms.ConnectionFactory are in unnamed module of loader 'app')
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
... 66 common frames omitted
Caused by: java.lang.ClassCastException: class com.ibm.mq.jms.MQConnectionFactory cannot be cast to class jakarta.jms.ConnectionFactory (com.ibm.mq.jms.MQConnectionFactory and jakarta.jms.ConnectionFactory are in unnamed module of loader 'app')
问题可能是因为IBM MQ不支持较高版本,或者与Spring 6不兼容,但不确定。正在寻找解决此问题的方法。
英文:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.jms.core.JmsTemplate]: Factory method 'jmsTemplate' threw exception with message: class com.ibm.mq.jms.MQConnectionFactory cannot be cast to class jakarta.jms.ConnectionFactory (com.ibm.mq.jms.MQConnectionFactory and jakarta.jms.ConnectionFactory are in unnamed module of loader 'app')
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
... 66 common frames omitted
Caused by: java.lang.ClassCastException: class com.ibm.mq.jms.MQConnectionFactory cannot be cast to class jakarta.jms.ConnectionFactory (com.ibm.mq.jms.MQConnectionFactory and jakarta.jms.ConnectionFactory are in unnamed module of loader 'app')
Issue might be because of IBM MQ is not supporting higher version or not compatible with spring 6 but not sure. looking for the resolution for the issue.
答案1
得分: 3
MQ提供与Jakarta兼容的软件包。您需要更改您的依赖项以使用正确的模块。
如果您正在使用MQ Spring Boot库,请使用相应的V3.x.x构件。
如果您直接引用MQ客户端库,请改用com.ibm.mq.jakarta.client
,而不是com.ibm.mq.allclient
。
英文:
MQ provides Jakarta-compatible packages. You have to change your dependencies to use the correct module.
If you're using the MQ Spring Boot library, then use the corresponding V3.x.x artifact.
If you are directly referencing the MQ client libraries, then use com.ibm.mq.jakarta.client
instead of the com.ibm.mq.allclient
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论