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)

huangapple go评论76阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年3月15日 18:02:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/75743151.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定