• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Exceptions

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Is there any difference in the following scnearios. Pls explain me.

SessionBean calls getPrimaryKey() on its context - IllegalStateException(HFEJB: Page 560)
Client Calls SessionBean getPrimaryKey() on the EJBObject - RemoteException(HFEJB: Page 559)

Thanks & Regards,
Yasin
[ February 25, 2006: Message edited by: Yasin S ]
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I understood it, Remote client does not get Runtime exceptions from remote EJB object. So it has to get a RemoteException (or subclass) instead of IllegalStateException which is a RuntimeException.
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes...there are 2 things in exception
bean->container->client
when the bean throws a IllegalStateException or any of the other SystemException the client sees it as either RemoteException or EJBException based on if it is remote or local. The client cant do anything useful with the system exception details.
Page 559 is what the client sees an page 560 is what the bean throws.
Hope this helps
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, if you look at EJBContext interface there is no getPrimaryKey(), so any attempt to call getPrimaryKey() using it's sub interface ie SessionContext object, you can't help it but get a fat java.lang.IllegalStateException.

On the second part, Session beans don't have primary key. but EJBObject interface has a getPrimaryKey(). So, when you call EJBObject.getPrimaryKey() on a session bean, for local client you javax.ejb.EJBException and remote client, java.rmi.RemoteException. Just look at this code


I think it's kind of Runtime Exception that is actually thrown from the background.

Whew, hope it helps.
 
Sahul Yasin
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Thanks for the replies. I have just taken the exam, scored 88%.

Regards,
Yasin
 
reply
    Bookmark Topic Watch Topic
  • New Topic