How to resolve Cannot narrow remote object to Home

Discussions

EJB programming & troubleshooting: How to resolve Cannot narrow remote object to Home

  1. Hi Friends! How to resolve the Error java.lang.ClassCastException: Cannot narrow remote object to Home at Client in Weblogic 8.1 Object obj = ic.lookup("JNDI_NAME"); SimpleCMPHome home = (SimpleCMPHome)PortableRemoteObject.narrow(obj,SimpleCMPHome.class); From the Google search i got a msg that stubs and Skeletons may not be created,but it's available in the jar file.So pls help thanx in Advance. Rgds Balaji
  2. From your its seem like you haven't added the remote propetries required (initalContext) for accessing remote EJBs.. As your remote client is in a different VM you should have those classes in your local jar file. Also i see you are trying to remote access a CMP may not be such a good idea.. Look up the Session Facade pattern..
  3. Thanx for ur message charles Lee, U pls give elabrote reply to resolve this problem.Ok i'll use session facade to implement CMP.But i got properties(Initial Context) Properties prop = new Properties(); prop.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); prop.put(Context.PROVIDER_URL,"t3://localhost:7001" ); InitialContext ic = new InitialContext(prop);