7 Replies Latest reply on Feb 1, 2006 11:17 AM by ppphoenixxx

    accessing stateful session beans in ears from the outside

    ppphoenixxx Newbie

      Hi,

      I have a strange ClassCastException problem in latest (today) Branch_4_0 CVS. I have not tried this on earlier versions, and the tutorial examples do all work - so I suspect it has something to do with ears and/or keeping interfaces separated.

      I have something like that:

      ifs.jar (contains interfaces)

      public interface Example
      {
       @Remove
       public void logout();
      }


      application.ear(contains a webapp + persistence beans + business logic, also contains ifs.jar in cp)
      @Stateful
      @Remote("Example.class")
      public class ExampleBean
      {
       public void logout()
       {
       dosomestuff;
       }
      }


      external_client (ifs.jar are in cp):

      .
      .
      InitialContext ic = new InitialContext();
      Example e = (Example) ic.lookup("application/ExampleBean/remote");
      .
      .


      I get a ClassCastException after the successful lookup. Debugging shows that an "Object obj = ic.lookup(...)" works perfectly and I get a $Proxy??? (??? are some numbers) Object.. but for some reason the cast does not work. In the tutorial the Object looks very similar but the cast does work. Has anyone an idea? If helpful I can provide a complete *.ear/*.jar example showing this behaviour.

      Regards,
      Bernd Froemel