• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB ClassCastException

 
Sam Wang
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i want to get a cmp's localhome interface in the same jar,everything is ok.
When i want to get a cmp's localhome interface (called 'ItemEntity') from another jar,the exception occurs:
java.lang.ClassCastException: Cannot narrow remote object to com.XXX.ItemEntityHome
My code is like:
Context ctx=new InitialContext();
ItemEntityHome itemHome = (ItemEntityHome)PortableRemoteObject.narrow(ctx.lookup("java:/comp/env/ejb/ItemEntity"),ItemEntityHome.class);
[ May 27, 2002: Message edited by: Stub Wang ]
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 486 EJBs by Monson-Hafel, O'Reilly, 3rd Edition
EJBs declared in the <ejb-local-ref> elements ... do not require use of PortableRemoteObject.narrow() ... use a simple native cast operation
 
Sam Wang
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,Rufus.I understand.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic