I'm trying to do something like this

Object objref = initial.lookup(...);
home = (UserHome)PortableRemoteObject.narrow(objref, EntityHome.class);

in JSP/Bean code.

When the EntityHome.class is in the WEB-INF/classes directory if get a ClassCastException on the narrow call.

However, when the EntityHome.class is not in the WEB-INF/classes but in the classpath of the servlet/EJB container things work fine.

The EJB has it's own copy of the Home class in it's EJB jar file.

Is there any reason why this might be happening? How does narrow determine if the cast is acceptable ( classname? class hash? where loaded from? )?

Is there any weirdness associated with webapps and the classes/lib dirs in the WEB-INF directory?

thx