1 2 Previous Next 16 Replies Latest reply on Oct 27, 2008 10:36 AM by Tim Fox

    JBoss Messaging - classcast exception

    Prabhu Natarajan Newbie


      We are migrating our project from Jboss MQ to Jboss Messaging.
      The following scenario works fine in Jboss MQ however it does not work in Jboss Messaging:

      Object A is a publisher, which publishes the messages to a JMStopic.
      Object B is a subscriber to topic.
      Object C is another subscriber to same topic.

      All 3 are individual J2ee projects using isolated (individual) Class loaders.

      A publishes the message, B and C reads the message.

      · B reads the message successfully and works fine.
      · When C reads the message the actual class is loaded from classloader of B instead of classloader of C (runtime,object class loader path shows the class is loaded from B). Hence class cast exception occurs.

      Code in B
      public void onMessage(Message message) {

      // message object is loaded from classloader of B.No exception


      Code in C
      public void onMessage(Message message) {

      // Message object is loaded from classloader of B, it was suppose to be loaded from classloder of C.Hence class cast exception occurs.


      It looks like a Class Loader problem while using the Jboss Messaging.

      Is it a bug or we need to do any additional configuration to fix this issue?
      If any one has come across this classcast exception please let us know the fix for this.

        1 2 Previous Next