5 Replies Latest reply on Sep 2, 2008 5:20 PM by ashwinbijani

    Strange java.lang.ClassCastException: org.jboss.axis.Message

    jwiesmann

      Hi all,

      i searched the whole forum, but i was not able to find a problem like this.
      Maybe anybody can help me finding a solution.

      I want to use a webservice to get some information from a iis server.
      I am using jboss 4.0.2.

      If i write a main method and just let my source run, everything works fine.
      If i trie to do the same with jboss, i will get a class cast exception.

      The error is the following:
      My "local - console" class is:
      org.apache.axis.Message
      if i start the server, it uses:
      org.jboss.axis.Message

      and tries to set the message @ the apache.axis.MessageContext, which ends with a class cast exception.

      If i replace jboss-saaj.jar and jboss-jarprc.jar with saaj.jar and jarpc.jar from apache.org it all works fine.
      But i do not know what happends to the rest of my jboss installation, if i just replace those two jar files...

      but just let some code show u what i mean:

      in a console / eclipse (right click, run as java application)

       Service service = new Service();
       Call call = (Call) service.createCall();
       call.setPassword(password);
       call.setUsername(userName);
       call.setTargetEndpointAddress(new java.net.URL(endPointUrl)); System.out.println(call.getMessageContext()); // org.apache.axis.MessageContext System.out.println(msg.getClass().getName());// org.apache.axis.Message
       call.getMessageContext().setMessage(msg);
       call.invoke();
      


      at my application server it looks like that:
       Service service = new Service();
       Call call = (Call) service.createCall();
       call.setPassword(password);
       call.setUsername(userName);
       call.setTargetEndpointAddress(new java.net.URL(endPointUrl)); System.out.println(call.getMessageContext());//org.apache.axis.MessageContext System.out.println(msg.getClass().getName());//org.jboss.axis.Message
       call.getMessageContext().setMessage(msg); // <-- classCastException
       call.invoke();
      


      You see the differents ? It ones uses jboss and the othertime apache. Why is that so? I copied saaj.jar and jarpc.jar to my lib folder.

      any idea or hints for me ?
      Thx !