I have two web applications running on one Tomcat instance. Tomcat has an embedded ActiveMQ broker (vm://localhost?marshal=true). The two web applications each have loaded an instance of a JAR file containing the classes that are being sent between the two applications.
When I send an ObjectMessage to the broker from one application and receive it in the other, I get a ClassCastException when casting the object to my type, as if the message type is not recognized. This problem disappears when I run an external instance of ActiveMQ and connection (with tcp://localhost:61616) or if I place the JAR containing the class definitions in Tomcat's shared library directory. Thus this seems to indicate a class loading problem. However, I was working under the assumption that ActiveMQ would serialize and deserialize ObjectMessages which should eliminate this type of problem. How can I get ActiveMQ to serialize the messages as if the broker were not embedded (without running an external broker)? I am using ActiveMQ version 5.4.1.
