How to get the HornetQ API to my ear application on Wildfly?
gberish Feb 22, 2016 7:22 PMI'm being totally defeated in my effort to move a simple test application (deployed as an ear package) from dead Glassfish to WildFly 9. I hope someone can offer any advice.
Here's my problem:
The WildFly log clearly shows my Message Driven Bean's onMessge(Message msg) method receives an ObjectMessage sent by my Java Client (A Java Swing GUI running outside any container)
Then the Wildfly Log confirms that msg.getClass().getSimpleName() returns HornetQObjectMessage.
But when I try to cast msg to HornetQObjectMessage (so I can extract the object)the WildFly Log says:
Caused by: java.lang.NoClassDefFoundError: org/hornetq/jms/client/HornetQObjectMessage at org.america3.gotest.server.messaging.GoMsgBean.onMessage(GoMsgBean.java:123)
I can see org/hornetq/jms/client/HornetQObjectMessage.class in this jar:
<WildFlyHome>\modules\system\layers\base\org\hornetq\main\hornetq-core-client-2.4.7.Final.jar
So I know its there.
Everything I find says my problem is I need to force WildFly's class loader to load dependencies for my application. In this case I think that means alerting WildFly to the fact my application needs the org.hornetq module.
But I can't find anywhere that shows me how to do that.
I tried adding this module I got from Oracle
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.acmemq">
<dependencies>
<!-- we depend on org.hornetq module since we will send messages to -->
<!-- the HornetQ server embedded in the local WildFly instance -->
<module name="org.hornetq" />
</dependencies>
</module>
Then I modified the module's name to be my package name - GoTest.ear. (But I'm still struggling to get a grip on dependencies so it was just a guess.)
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="GoTestEar">
<dependencies>
<module name="org.hornetq" />
</dependencies>
</module>
And the error remains.
Can anyone offer any help on how to get the class loader to make HornetQObjectMessage available to my application? (Other than packaging a jar that contains it with my application. Note: My Java client already uses the WildFly jar above to send its ObjectMessage as a HornetQObjectMessage.