• Post Reply Bookmark Topic Watch Topic
  • New Topic

PortableRemoteObject.Narrow creates Class cast Exception

 
Siva Ram
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
In the Sun One App server 7.0, I deployed the stateless ejb without error / warning.
While doing ejb lookup , I am getting class cast exception any idea why?
Thanks in Advance,
Siva
 
Siva Ram
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While I am trying this, I am getting the following results.
out.print("before lookup"+"<br>");
objref = ctx.lookup("java:comp/env/ejb/PinManager");
out.print("after lookup"+"<br>");%>
<%=objref.toString() %>
<%out.print("<br>"+objref.getClass()+"<br>");
out.print(objref.getClass().getName()+"<br>");
lHome = (LHome)PortableRemoteObject.narrow(objref, LHome.class);
Results :
before lookup
after lookup
com.sun.jndi.cosnaming.CNCtx@1988886
class com.sun.jndi.cosnaming.CNCtx
com.sun.jndi.cosnaming.CNCtx
java.lang.ClassCastException
Any ideas ?
Thanks,
Siva
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to narrow down local interfaces.
 
Siva Ram
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Lasse .
Without narrowing also , I am getting the same error.
Any thoughts ?
Thanks,
Ravi
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No idea, sorry. I just realized that the object you looked up is com.sun.jndi.cosnaming.CNCtx instead of the EJBHome stub. Have you tried googling real hard?
 
Siva Ram
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. The answers given in google are already tried by me.
No progress.
Thanks,
 
ron jay
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Siva Ram,
I seem to be getting a similar problem to yours. Have you managed to solve yours yet??
Cheers,
Ron
 
Siva Ram
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keep it in an ear and deploy the ejb. It works fine.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!