'CachingConnectionFactory(jakarta.jms.ConnectionFactory)' cannot be applied to '(com.ibm.mq.jms.MQConnectionFactory)'

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

'CachingConnectionFactory(jakarta.jms.ConnectionFactory)' cannot be applied to '(com.ibm.mq.jms.MQConnectionFactory)'

问题

在我的项目中,我正在使用 Apache Camel + IBM MQ + Spring Boot 进行消息传递。我遇到了一个编译时错误,我无法解决。

com.ibm.mq.jms.MQConnectionFactory mqQueueConnectionFactory = new MQQueueConnectionFactory();
// 设置 mqQueueConnectionFactory 的所有属性,如队列管理器等。
CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(mqQueueConnectionFactory);

现在在第二行,我遇到了这个错误:

Now on the second line I am getting this err:
'org.springframework.jms.connection.CachingConnectionFactory' 中的 'CachingConnectionFactory(jakarta.jms.ConnectionFactory)' 无法应用于 '(com.ibm.mq.jms.MQConnectionFactory)'

我已经进行了大量的谷歌搜索,但没有找到任何类似的示例。任何帮助将不胜感激。我的 build.gradle 文件中包含以下依赖项。

// Camel
implementation 'org.apache.camel.springboot:camel-spring-boot-starter:4.0.0-M1'
implementation('org.apache.camel.springboot:camel-servlet-starter:4.0.0-M1')
implementation('org.apache.camel.springboot:camel-jaxb-starter:4.0.0-M1')
implementation("org.apache.camel:camel-jms:4.0.0-M1")
implementation("org.apache.camel:camel-core:4.0.0-M1")

// IBM MQ
implementation("javax.jms:javax.jms-api:2.0.1")
implementation("com.ibm.mq:com.ibm.mq.allclient:9.1.0.5")
implementation("com.ibm.ims:udb:15.1.31")
implementation("javax.xml.bind:jaxb-api:2.4.0-b180830.0359")

希望这对你有所帮助。

英文:

In my project, I am using apache camel + ibm mq + spring boot for messaging. I am getting a compile time err which I am not able to resolve.

com.ibm.mq.jms.MQConnectionFactory mqQueueConnectionFactoy = new MQQueueConnectionFactory();
// set all the properties to above mqQueueConnectionFactoy such as queue manager etc.
CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(mqQueueConnectionFactoy);

Now on the second line I am getting this err:

Now on the second line I am getting this err:
'CachingConnectionFactory(jakarta.jms.ConnectionFactory)' in 'org.springframework.jms.connection.CachingConnectionFactory' cannot be applied to '(com.ibm.mq.jms.MQConnectionFactory)'

I have googled a lot but not able to find any such example. Any help would be appreciate. My build.gradle has below dependencies.

// Camel
    implementation 'org.apache.camel.springboot:camel-spring-boot-starter:4.0.0-M1'
    implementation('org.apache.camel.springboot:camel-servlet-starter:4.0.0-M1')
    implementation('org.apache.camel.springboot:camel-jaxb-starter:4.0.0-M1')
    implementation("org.apache.camel:camel-jms:4.0.0-M1")
    implementation("org.apache.camel:camel-core:4.0.0-M1")

    // IBM MQ
    implementation("javax.jms:javax.jms-api:2.0.1")
    implementation("com.ibm.mq:com.ibm.mq.allclient:9.1.0.5")
    implementation("com.ibm.ims:udb:15.1.31")
    implementation("javax.xml.bind:jaxb-api:2.4.0-b180830.0359")

答案1

得分: 3

需要将您的com.ibm.mq.allclient依赖替换为com.ibm.mq.jakarta.client,并将javax.jms-api:2.0.1替换为jakarta.jms-api

请参考以下链接获取更多信息:

英文:

You will need to replace your com.ibm.mq.allclient dependency with com.ibm.mq.jakarta.client and replace javax.jms-api:2.0.1 with jakarta.jms-api

Ala

https://www.ibm.com/docs/en/ibm-mq/9.3?topic=umcjm-obtaining-mq-classes-jms-mq-classes-jakarta-messaging-separately

See https://mvnrepository.com/artifact/com.ibm.mq/com.ibm.mq.jakarta.client and https://mvnrepository.com/artifact/jakarta.jms/jakarta.jms-api for latest versions.

huangapple
  • 本文由 发表于 2023年3月1日 11:40:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75599371.html
匿名

发表评论

匿名网友

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

确定