• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

com.ibm.mq.jakarta.jms import issue

 
Ranch Hand
Posts: 1029
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,


I have below import in one of my class


import com.ibm.mq.jakarta.jms.MQQueueConnectionFactory;

Open in new window

I did maven clean  then maven install from my intellij idea but still getting below errors

package com.ibm.mq.jakarta.jms does not exist

I have cleaned my repository also to remove all old jars in cache.

Please advise
 
Bartender
Posts: 15743
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, do you have the appropriate dependency in your POM?
 
sai rama krishna
Ranch Hand
Posts: 1029
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This class supposed to be in below jar (also there are transitive dependencies pulled by other different jars by spring boot)which is working in other micro service on other machine.
com.ibm.mq.jakarta.client-9.3.4.0.jar
This particular micro service on different machine does not pull it some reason
I noticed in past some cache issues with intellij idea. I am on intellij idea 2021. I will try with intellij idea 2023 as well and see.
 
Stephan van Hulst
Bartender
Posts: 15743
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not how it works. You're building your application with Maven, so Maven needs to know all the dependencies you require to build the application.

Please show us the pom.xml file in the root directory of your project.
 
sai rama krishna
Ranch Hand
Posts: 1029
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have below dependencies and build plugins in my POM.xml.  I have repositories section and pluginrepositories section and distribution management section with jfrog urls as well

 
sai rama krishna
Ranch Hand
Posts: 1029
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After excluding below that error got resolved.


But getting below error from other class now from below methods

fct.setConnectionFactory(mqQueueConnectionFactoryX());
  fct.setConnectionFactory(mqQueueConnectionFactoryY());

 
cannot access javax.jms.ConnectionFactory
incompatible types: com.ibm.mq.jakarta.jms.MQQueueConnectionFactory cannot be converted to javax.jms.ConnectionFactory.
Please advise
 
Bartender
Posts: 291
7
Android Python Oracle Postgres Database Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

This class supposed to be in below jar (also there are transitive dependencies pulled by other different jars by spring boot)which is working in other micro service on other machine.
com.ibm.mq.jakarta.client-9.3.4.0.jar



Following dependency is missing from the pom: https://mvnrepository.com/artifact/com.ibm.mq/com.ibm.mq.jakarta.client/9.3.4.0

 
sai rama krishna
Ranch Hand
Posts: 1029
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I have below dependency as well in POM.xml as last dependency. I missed it originally while copy pasting it

 
Roland Mueller
Bartender
Posts: 291
7
Android Python Oracle Postgres Database Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jakarta does not work with javax.jms-api and jakarta.jms-api replaces according to my knowledge javax.jms-api.

Then this should be missing too:

https://mvnrepository.com/artifact/jakarta.jms/jakarta.jms-api/3.1.0

 
Roland Mueller
Bartender
Posts: 291
7
Android Python Oracle Postgres Database Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Roland Mueller wrote:Jakarta does not work with javax.jms-api and jakarta.jms-api replaces according to my knowledge javax.jms-api.

Then this should be missing too:

https://mvnrepository.com/artifact/jakarta.jms/jakarta.jms-api/3.1.0



Bad me :-( This is already in your pom.xml from some messages ago.
 
Roland Mueller
Bartender
Posts: 291
7
Android Python Oracle Postgres Database Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sai rama krishna wrote:A
But getting below error from other class now from below methods

fct.setConnectionFactory(mqQueueConnectionFactoryX());
  fct.setConnectionFactory(mqQueueConnectionFactoryY());

 
cannot access javax.jms.ConnectionFactory
incompatible types: com.ibm.mq.jakarta.jms.MQQueueConnectionFactory cannot be converted to javax.jms.ConnectionFactory.
Please advise



There should be some import using javax stuff instead of jakarta packages. You should check the imports in Java and may be make a check the Maven dependency tree for javax.
 
sai rama krishna
Ranch Hand
Posts: 1029
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have spring-jms 6.0.13 dependency in POM.xml but due to intellij idea cache related issues stills shows spring-jms-5.3.24 for DefaultJmsListenerContainerFactory class containing jar
 
Saloon Keeper
Posts: 28993
214
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are using Spring, then you should be using Spring JMS. And using a version of Spring JMS that corresponds to the type of JMS (javax or jakarta) that matches your JMS server.
 
sai rama krishna
Ranch Hand
Posts: 1029
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using springboot 3.1. 4 and also spring. Spring jms version supposed to be managed by spring boot 3.1.4 version or I have to manage. Also JFROG is blocking lot of jars and version like below json jar as below due to vulnerabilities.
https://mvnrepository.com/artifact/org.json/json.
I did exclude jars from

I am facing some other issues using intellij idea community version while connecting to TFS repository.

Spending more time in  solving these IDE related issues, security related issues than actual coding daily.
If I use intellij idea 2021.2.1 community version and some times getting below kind of errors while getting latest code from TFS due to some existing bug
https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000597044--Couldn-t-check-the-working-tree-for-unmerged-files-because-of-an-error-

If I use intellij idea 2023 community version get different errors like below while getting latest code from TFS

https://intellij-support.jetbrains.com/hc/en-us/community/posts/12744271234450-Git-error-unable-to-read-askpass-response-after-updating-to-2023-2-version-of-IntelliJ
As mentioned in above thread I am trying below solution
File > Invalidate Caches.. > enable Clear file system cache and Local History option > Invalidate and Restart)
But under file i do not see invalidate caches
I see 'invalidate caches' under File -->settings but I do not see below option
" enable Clear file system cache and Local History option > Invalidate and Restart"
InvalidateCache.JPG
[Thumbnail for InvalidateCache.JPG]
FileOptions.JPG
[Thumbnail for FileOptions.JPG]
 
sai rama krishna
Ranch Hand
Posts: 1029
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

How to check the imports in Java. Is it like checking import statements at top of class right?

How to check the Maven dependency tree for javax in intellij idea? In POM " dependency analyzer" view as attached right? Not sure what is difference between :All dependencies as a list" and "All dependencies as tree" options.

Also DAO class also has javax imports which are not touched in other working micro projects but only touched in other classes, layers to convert from javax to jakarta which sounds to me like half conversion only. Not sure what is the reasoning behind that.

What is JMS server? Is it IBM MQ queue or spring boot tomcat server I am using on intellij idea to run this micro service to consume message on the IBM MQ queue?
dependency-analyzer.JPG
[Thumbnail for dependency-analyzer.JPG]
 
sai rama krishna
Ranch Hand
Posts: 1029
2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all for your help with this issue.

Now it is all working fine.

I added below dependency which is not blocked by jfrog which does not have vulnerablilities
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20231013</version>
</dependency>


Also install intellij idea 2023.2.5 latest version resolved askpass errors as per below bug.
https://intellij-support.jetbrains.com/hc/en-us/community/posts/12744271234450-Git-error-unable-to-read-askpass-response-after-updating-to-2023-2-version-of-IntelliJ


Also below command from command prompt (after verifying git) resolved ownership bug related errors as per below bug
https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000597044--Couldn-t-check-the-working-tree-for-unmerged-files-because-of-an-error-

C:\Users\xyz>git config --global --add safe.directory C:/Users/xyz/Documents/DDrive/aaa-bbbmessages

C:\Users\xyz>


Also "reimport" and "Build Project" resolved some of cache issues on intellij idea to refresh as per latest maven dependencies modified in pom.xml

BuildPrj.JPG
[Thumbnail for BuildPrj.JPG]
dependency-analyzer_pom.JPG
[Thumbnail for dependency-analyzer_pom.JPG]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am also getting the same issue. want to add JmsComponent.
MQQueueConnectionFactory connectionFactory = new MQQueueConnectionFactory();
connectionFactory.setQueueManager(communicationData.getQueueManager());
connectionFactory.setHostName("");
connectionFactory.setPort("");
connectionFactory.setChannel("");
connectionFactory.setTransportType(Integer
.parseInt("1"));
if (StringUtils.isNotEmpty(communicationData.getCcsid())) {
connectionFactory.setCCSID(Integer.parseInt(""));
connectionFactory.setTargetClientMatching(false);
JmsTransactionManager transactionManager = new JmsTransactionManager((ConnectionFactory) connectionFactory); // not compatible

synchronized public void addJMSComponent(CamelContext camelContext, String componentName,
MQQueueConnectionFactory connectionFactory, JmsTransactionManager transactionManager) {
if(camelContext.getComponent(componentName) == null){
JmsComponent jmsComponent = new JmsComponent();
jmsComponent.setTransactionManager(transactionManager);
jmsComponent.setConnectionFactory((ConnectionFactory) connectionFactory);
jmsComponent.setTransacted(true);

camelContext.addComponent(componentName, jmsComponent);
}
Using Spring Boot 3.1.1 with Apache Camel 4 and IBM MQ 9.2.4.0
class com.ibm.mq.jms.MQQueueConnectionFactory cannot be cast to class jakarta.jms.ConnectionFactory (com.ibm.mq.jms.MQQueueConnectionFactory and jakarta.jms.ConnectionFactory

Will you please share the clear steps followed. It will be very helpful
 
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic