Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

ClassCastException.

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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);
}
reply
    Bookmark Topic Watch Topic
  • New Topic