10 Replies Latest reply on Aug 9, 2007 6:11 AM by marklittle

    classloader problem?

    jw

      Im using ESB 4.2.MR3.

      A client sends a JMS Object Message. The content is of type ClassA.
      In an action I can call

      message.getBody().get().getClass().getName()


      and it returns the right class name (which is ClassA). But trying to
      assign the value like

      ClassA a;
      
      a = (ClassA)message.getBody().get()


      raises a ClassCastException. It seems, that different Classloaders are used. Serializing message.getBody().get() and deserializing it into a solves the problem (but that must be only a workaround).

      Any ideas whats wrong?


        • 1. Re: classloader problem?
          marklittle

          Can you show me the code that you use to populate the message you're sending? Is it an ESB-aware client, for example?

          • 2. Re: classloader problem?

            Try to create the message with MessageType.JAVA_SERIALIZED, but ClassA must implements Serializable

            • 3. Re: classloader problem?
              jw

              Hi Mark

              The message comes through the gateway. So | just write a normal JMS Object Message to the queue the gateway is listening.

              • 4. Re: classloader problem?
                marklittle

                So if I'm understanding you correctly, you're using the standard JMS Gateway? Do you provide your own JMS composer implementation?

                The standard gateway composer creates a default Message, which is XML. Can you also confirm (by calling Message.getType()) that you're dealing with an XML implementation?

                • 5. Re: classloader problem?
                  marklittle

                  BTW, just so we're clear, when you said:


                  Serializing message.getBody().get() and deserializing it into a solves the problem (but that must be only a workaround).


                  What precisely did you do?

                  • 6. Re: classloader problem?
                    marklittle

                    Can you also try the following: set org.jboss.soa.esb.message.default.uri in the "core" section of the ESB property file to urn:jboss/esb/message/type/JAVA_SERIALIZED and rerun your example.

                    • 7. Re: classloader problem?
                      jw

                      Hi Mark

                      Hot deplyment was the problem. It works after a restart.

                      Just to answer your questions:

                      So if I'm understanding you correctly, you're using the standard JMS Gateway?

                      yes

                      Do you provide your own JMS composer implementation?

                      no


                      Can you also try the following: set org.jboss.soa.esb.message.default.uri in the "core" section of the ESB property file to urn:jboss/esb/message/type/JAVA_SERIALIZED and rerun your example.

                      has no effect. message.getType() is always XML (but that's not a problem for me).

                      Thanks for help
                      Juerg

                      • 8. Re: classloader problem?
                        marklittle

                        So this wasn't an issue with JBossESB? I just want to be sure we don't miss something in the next GA release. Thanks.

                        • 9. Re: classloader problem?
                          jw

                          no, I think it's a 'hot deployment side effect' and not an ESB problem.

                          • 10. Re: classloader problem?
                            marklittle

                            OK, thanks.