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

Book error or not ?? Client calls remove() on a bean that's already been removed.

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. Confusion.

In headfirst EJB, page 559:

Client scenarios:

(What happens when) Client calls remove() on a bean that's already been removed:

(Answer): "...Remember, remove() is just another method in the bean's interface, and if you call it on a removed bean, you'll get the same exception you'd see if you called any other business method on a removed bean - remote clients get a RemoteException, local client get EJBException"

Ok im think that statement is WRONG. But im sure i just have a bug in my understanding, please could somebody set me straight.

Now - when a client calls a method on a bean that has been removed you get a
"java.rmi.NoSuchObjectExecption"
I have written code to test that and found it to be the case.

Then i tried another test. I called remove on an object twice - to try and remove and object which had been removed. And guess what exception i got - the same as a business method ( like the explaination form the book says ), but thats a "java.rmi.NoSuchObjectExecption", NOT a RemoteException !!!

The book is wrong right ?? they have miss printed right ??? Or have I gone MAD !!!

Thanks for you time guys !!
[ December 13, 2004: Message edited by: Dean Fredericks ]
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.rmi.NoSuchObjectException is a subclass of java.rmi.RemoteException which gives the client some more information 'bout what's going on on the server.
If the client receives the java.rmi.RemoteException or the javax.ejb.EJBException from a method invocation, the client, in general, does not know if the enterprise Bean�s method has been completed or not.

Greetz,
Puba
 
Dean Fredericks
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for trying to reply puba, however i dont think ur answer satifies my question. Yes i relise the the once exception is a subclass of the other, but the fact is a "java.rmi.NoSuchObjectExecption", while the book says its a
"RemoteException".


I want to know why my finding are inaccurate, or if the book is wrong.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EJB 2.0 Spec -
18.3.5 Non-existing session object
If a client makes a call to a session object that has been removed, the Container should throw the
java.rmi.NoSuchObjectException (Subclass of java.rmi.RemoteException)
to a remote client, or the javax.ejb.NoSuchObjectLocalException (Subclass of EJBException) to a local client.

>Then i tried another test. I called remove on an object twice - to try and remove and object which had been
>removed. And guess what exception i got - the same as a business method ( like the explaination form the book says )
> , but thats a "java.rmi.NoSuchObjectExecption", NOT a RemoteException !!!

Just remember inheritance ... Dog IS AN Animal!
java.rmi.NoSuchObjectExecption IS A RemoteException!
[ December 13, 2004: Message edited by: Adrian F ]
 
Dean Fredericks
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont seem to be getting the responces I was hoping for in this post.

U guys so far have pointed out the ovious that "java.rmi.NoSuchObjectExecption" is a subclass of RemoteException. Yes i know that thats easy.

WHY DOES THE BOOK SAY A REMOTEEXCEPTION IS THROWN WHEN REALLY A "java.rmi.NoSuchObjectExecption" IS THROWN <---- SURELY THAT IS A BOOK ERROR.

As Adrian F has pointed out - the spec says
EJB 2.0 Spec -
18.3.5 Non-existing session object
If a client makes a call to a session object that has been removed, the Container should throw the
java.rmi.NoSuchObjectException (Subclass of java.rmi.RemoteException)


SURELEY THE BOOK IS WRONG IF THE SPEC SAYS IT SHOULD be a java.rmi.NoSuchObjectException.
 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I agree with Dean.
I have been very confused with the statement of HFEJB.
Why did not they say "NoSuchObjectException" insted of saying "RemoteException.?

Vagner
 
Adrian Fuckabee
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HFEJB p550 has a block of text that mentions that the client might NOT get the most specific exception!

It appears that which Exception the client gets depends on the container.
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dean, I suggest you file an errata in this website.
http://www.oreilly.com/catalog/hfjejb/errata/

Shiang
 
Won't you be my neighbor? - Fred Rogers. tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic