7 Replies Latest reply on Jun 30, 2005 12:14 PM by Bruno Aranda

    Beta1: wrong object class when getting session bean from con

    Bruno Aranda Newbie

      Hi all,

      JBoss: 4.0.3RC1 (graphical install) or 4.0.2 (manually installing ejb3.deployer, etc)
      EJB3: beta1
      JDK 5.0

      first of all, I have to say that the application I am developing work ok using EJB3 preview 5 and Jboss 4.0.1sp1.
      This application has several session beans (stateless and stateful). Each bean has a interface with the @Remote annotation. Deploy goes ok, without problems neither warnings...
      Now, when inside the application (a war) I try to access to a bean the wrong class is returned, while if I get the bean from a client (in a suite of tests that I have outside JBoss everything goes ok).

      Let's illustrate the situation:

      I have:

      @Statefull
      public class UserHandlerBean extends UserHandler implements Serializable {
      ...
      }
      
      @Remote
      public interface UserHandler {
      ...
      }


      Now, I access to the bean (from the webapp inside Jboss or a client test) like this:

      InitialContext ctx = new InitialContext();
      UserManager um = (UserManager) ctx.lookup(UserManager.class.getName());


      From the client wverything runs smoothly, but, from the webapp I get the exception:

      java.lang.ClassCastException: $Proxy103
      ...


      Something happens here, the class that the webapp obtains from the sever InitialContext is of class $Proxy103 and does not implement UserManager :-(

      Any hint will be appreciated,

      Regards,

      Bruno