Results 1 to 5 of 5

Thread: JMSMessaging - getObject()

  1. #1
    Join Date
    Oct 2008
    Posts
    3

    Default JMSMessaging - getObject()

    I use jboss4.2.2GA and messaging 1.3.0GA with spring 2.0


    I send message :

    Code:
    public void sendMessage(final MyMessage s) {
    		
    		jmsTemplate.convertAndSend(s);
    }
    where is MyMessage is simple POJO, also it is an external jar file included in both applications.

    and on the other side I have web application for listening :
    Code:
    public void onMessage(Message m) {
    		try {
    			if (m instanceof ObjectMessage) {
    //           MyMessage myMsg = new MyMessage(); // this works fine
                                    ObjectMessage om = (ObjectMessage) m;
    				MyMessage mm = (MyMessage) om.getObject();
                       } catch(Exception e) {
    			e.printStackTrace();
    		   }
    }
    but it doesn't work properly, i get error :


    ERROR [STDERR] java.lang.RuntimeException: No ClassLoaders found for: com.message.MyMessage
    ....

    whats wrong here?!

  2. #2
    Join Date
    Jan 2008
    Location
    San Diego
    Posts
    780

    Default

    Is the class for MyMessage in the classpath for the web application that is receiving the JMS message?

  3. #3
    Join Date
    Oct 2008
    Posts
    3

    Default

    class path is empty, and MyMessage is deployed in the same dir where are other jars.

    but if i declare variable myMsg without rest of code in method onMessage() it works fine and there is no error...according to that web application knows where is MyMessage class/jar.

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    Make sure that it is only once on the classpath, I suspect some classloader issues here.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Oct 2008
    Posts
    3

    Default

    I make both applications as web application and everything works fine, but there is a question (didn't try it with classpath, i will try it but i don't have much time now) is there any way to do this if message dispatcher is not a web application?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •