Hi all
I am trying to build a servlet client to look up an ejb.
But, i got the following error.
500 Internal Server Error
java.lang.ClassCastException: CartHome_StatefulSessionHomeWrapper1
at
javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java, Compiled
Code)
at testCart.doGet(testCart.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java,
Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java,
Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java,
Compiled Code)
at com.evermind.server.http.du.rr(JAX, Compiled Code)
at com.evermind.server.http.du.forward(JAX, Compiled Code)
at com.evermind.server.http.d5.rx(JAX, Compiled Code)
at com.evermind.server.http.d5.rw(JAX)
at com.evermind.util.f.run(JAX, Compiled Code)
this is what i did to do the look up.
final Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.ApplicationClientInitialContextFactory");
properties.setProperty(Context.PROVIDER_URL,"ormi://localhost/ejbsamples");
properties.setProperty(Context.SECURITY_PRINCIPAL,"username");
properties.setProperty(Context.SECURITY_CREDENTIALS, "password");
Context context = new InitialContext(properties);
Object homeObject = context.lookup("MyCart");
CartHome home = (CartHome)PortableRemoteObject.narrow(homeObject,CartHome.class);
Cart cart = (Cart)PortableRemoteObject.narrow(home.create(), Cart.class);
Can anyone tell me why it failed ?
Thanks a lot.
-kit