• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

portable remote object class conversion

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When i deploy a session bean in JBoss, while deploying i got classcast exception . When i am looking thro ctxlook up, it is always returing the object ref as JNDI name+Home. why this error is coming? i need help.
servlet code

code:

try {

InitialContext ctx = new InitialContext();
System.out.println("aaaaaaaaaa");

Object objref = ctx.lookup("ejb/test/MyTestSessionBean/remote");
//testSessionBean = (MyTestSessionHome)ctx.lookup("test.session.MyTestSessionBean.class.getName());
//testSessionBean = (MyTestSessionHome)ctx.lookup("test/session/MyTestSessionBean");
System.out.println("bbbbbbbbb"+objref);

testSessionBean = (MyTestSessionHome)PortableRemoteObject.narrow(objref, MyTestSessionHome.class);
System.out.println("ccccccccc");

} catch (Exception NamingException) {

NamingException.printStackTrace();



THis is the output in Jboss:

393 INFO [STDOUT] bbbbbbbbbejb/test/MyTestSessionBean/remoteHome
11:43:38,408 ERROR [STDERR] java.lang.ClassCastException
11:43:38,413 ERROR [STDERR] at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)


If the code is like this in the lookup:
Object objref = ctx.lookup("ejb/test/MyTestSessionBean");


It returns objref like this:MyTestSessionBeanHome - This class does not exist.
I need help.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic