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?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4031168#4031168

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4031168
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to