This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes ClassCastException. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "ClassCastException." Watch "ClassCastException." New topic
Author

ClassCastException.

bksella sella
Ranch Hand

Joined: Jul 31, 2003
Posts: 32
Hi,
I get a java.lang.ClassCastException: Cannot narrow remote object to cm
p.EmployeeHome at line marked : "1". Can u help me out in solving this problem. I am running this under wls8.1.
private EmployeeHome lookupHome() {
try {
ctx = getInitialContext();
Object obj = ctx.lookup("EMPLOYEEHOME");
1:----------home = (EmployeeHome) PortableRemoteObject.narrow(obj, EmployeeHome.class);
} catch (NamingException ne) {
System.out.println("In lookupHome() : " + ne);
}
return home;
}
private Context getInitialContext() throws NamingException {
Properties properties = null;
try {
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, "t3://localhost:7001");
} catch (Exception e) {
System.out.println("In getInitialContext() : " + e);
}
return new InitialContext(properties);
}
 
wood burning stoves
 
subject: ClassCastException.
 
Similar Threads
Running Client Application from Windows98
jsp and ejb
JNDI lookup in EJBHomeFactory pattern
Problem getting context in WLS 8.1
Invoking weblogic ejb through iiop