2 Replies Latest reply on Mar 23, 2007 3:44 PM by Eric Anderson

    Can't access session facade bean

    Eric Anderson Newbie

      I don't understand why I am getting a classcastexception...

      From the rmx console

       +- SDS_DATA (class: org.jnp.interfaces.NamingContext)
       | +- SessionEJB (class: org.jnp.interfaces.NamingContext)
       | | +- local (proxy: $Proxy97 implements interface org.usiis.model.SessionEJBLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
       | | +- remote (proxy: $Proxy96 implements interface org.usiis.model.SessionEJB,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
      


      My java code

      import javax.naming.Context;
      import javax.naming.InitialContext;
      
      import org.usiis.model.SessionEJB;
      import org.usiis.model.SessionEJBLocal;
      
      public class ContextManager {
      
       private final String oc4jRemote = "SessionEJB";
       private final String bossRemote = "SDS_DATA/SessionEJB/remote";
       private final String bossLocal = "SDS_DATA/SessionEJB/local";
      
       public ContextManager() {
       }
      
      
       public SessionEJB getRemoteContext ()throws Exception {
       final Context context = new InitialContext();
       //SessionEJB b = (SessionEJB) context.lookup(oc4jRemote);
       SessionEJB b = (SessionEJB) context.lookup(bossRemote);
      
       return b;
       }
      
      
       public SessionEJBLocal getLocalContext() throws Exception {
       final Context context = new InitialContext();
       SessionEJBLocal b = (SessionEJBLocal) context.lookup(bossLocal);
      
       return b;
       }
      


      The error

      
      2:35:36,674 ERROR [STDERR] java.lang.ClassCastException: $Proxy97
      2:35:36,674 ERROR [STDERR] at org.usiis.view.backing.ContextManager.getLoca
      Context(ContextManager.java:30)
      
      



      Can anyone explain why the cast is not working?