3 Replies Latest reply on Jan 4, 2008 6:47 AM by Flavio Pompermaier

    Unable to call Stateful Session bean

    Flavio Pompermaier Newbie

      Hi to all,
      I've lost all the day trying to figure out why I'm not able to use a Stateful bean: I'm really disperated!
      In my project I am able to call everything, except this Stateful bean! I've Stateless session, resources and so on!

      I lookup correctly to the object, but I cannot cat it to the interface class. The Exception throwed is an IllegalCastException: $Proxy195 (althought the Proxy number change at each deployment).

      It seems that the looked up object is not an instance of the interface!, althought the JNDI deploy it correctly! (see below)

      This is the output of the JNDI view:

      +- NewsCrawler (class: org.jnp.interfaces.NamingContext)
      | +- UserSessionFacadeBean (class: org.jnp.interfaces.NamingContext)
      | | +- local (proxy: $Proxy97 implements interface nc.session.facade.user.UserSessionFacadeLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
      | | +- remote (proxy: $Proxy96 implements interface nc.session.facade.user.UserSessionFacade,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
      | +- UserStatefulBean (class: org.jnp.interfaces.NamingContext)
      | | +- remote (class: java.lang.Object)
      | | +- remoteStatefulProxyFactory (proxy: $Proxy68 implements interface org.jboss.ejb3.ProxyFactory)

      | +- AdminSessionFacadeBean (class: org.jnp.interfaces.NamingContext)
      | | +- remote (proxy: $Proxy93 implements interface nc.session.facade.admin.AdminSessionFacade,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)

      and this is the simple Stateful bean I want to call:
      package nc.session.stateful;
      import nc.gwt.client.dtos.*;
      import javax.ejb.Remote;
      public interface UserStateful{
       public boolean login();
       public boolean logout();
       public UserStateDTO isLogged();
       public void setUserDTO(UserDTO u);
       public void addHistoryToken(String token);
      package nc.session.stateful;
      import java.util.List;
      import javax.ejb.Stateful;
      import nc.gwt.client.dtos.*;
      public class UserStatefulBean implements UserStateful{
       private UserStateDTO status=new UserStateDTO(false);
       public boolean login(){
       return true;
       public boolean logout(){
       return false;
       public UserStateDTO isLogged(){
       return status;
       public void setUserDTO(UserDTO u){
       public void addHistoryToken(String token){
       List<String> l=status.getHistory();

      Any Ideas?
      Thanks in advanced, Flavio