Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] JMS Listener/Reader no longer works with ActiveMQ #6111

Open
fallensieg opened this issue Feb 21, 2024 · 5 comments
Open

[BUG] JMS Listener/Reader no longer works with ActiveMQ #6111

fallensieg opened this issue Feb 21, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@fallensieg
Copy link

fallensieg commented Feb 21, 2024

Describe the bug
JMS Sender/Listener channels no longer work with ActiveMQ.

To Reproduce
I have several JMS Sender / Listener channels with ActiveMQ (5.15.11) working fine in Mirth 4.0.1
Now I'm trying to upgrade Mirth to 4.4.2 and when I try to send a message to ActiveMQ I get the error:
org.apache.activemq.ActiveMQConnectionFactory cannot be cast to javax.jms.ConnectionFactory

imatge.png

I've tried to downgrade to Mirth 4.3 and the error is the same, but with Mirth 4.2 it works again. Have also tired upgrading to 4.5, same problem.
Am I doing something wrong, or could it be a bug from Mirth 4.3 and above?
Anyone knows a workaround for this issue?

Expected behavior
JMS Listener and Sender can read/write messages against ActiveMQ.

Actual behavior
Channels will not even start with the following error message

Caused by: java.lang.ClassCastException: class org.apache.activemq.ActiveMQConnectionFactory cannot be cast to class javax.jms.ConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory is in unnamed module of loader com.mirth.connect.server.util.ChildFirstURLClassLo ader @17f0d6e; javax.jms.ConnectionFactory is in unnamed module of loader java.net.URLClassLoader @3970ed7e) at com.mirth.connect.connectors.jms.JmsClient.start(J msClient.java:129)

Environment (please complete the following information):

  • OS: Windows 10
  • Java: OpenJDK 11
  • Connect Version : anything above 4.0.1

Workaround(s)
Would be intered in knowing.

Additional context
Add any other context about the problem here.

@fallensieg fallensieg added the bug Something isn't working label Feb 21, 2024
@fallensieg fallensieg changed the title [BUG] Your Issue Title [BUG] JMS Listener/Reader no longer works with ActiveMQ Feb 21, 2024
@pacmano1
Copy link
Collaborator

Maybe upload a sample channel?

@ab-mg-23
Copy link

The problem is using a resource to load the ActiveMQ Client library and commit fd3b7b2 changing the child classloader to take effect before the cast from the concrete ActiveMQConnectionFactory to the ConnectionFactory interface. The interface definition is in a different classloader than the concrete definition, so Java throws an error on the cast. If you move the client JAR and dependencies into server-lib/jms that should load everything from the same classloader as a workaround, but then run the risk of classpath issues with dependencies.

@fallensieg
Copy link
Author

Thank you @ab-mg-23. That was exactly the issue and doing what you've suggested has resolved my problem.

@hae-anyoung
Copy link

Adding this for reference. More people are seeing this issue. https://forums.mirthproject.io/forum/mirth-connect/support/184548-jms-sender-and-activemq

@hae-anyoung
Copy link

If you move the client JAR and dependencies into server-lib/jms that should load everything from the same classloader as a workaround, but then run the risk of classpath issues with dependencies.

This didn't work for me. Still getting the ClassCastException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants