Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

java.rmi.RemoteException

 
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
On ejbcertificate, the following question is aked:

Which of the following statements are true when a session bean's client receives a java.rmi.RemoteException? [Check all correct answers]


The following response is considered as valid:

The container does not throw the java.rmi.RemoteException if the container performs a transaction rollback.


Is this right? According to spec p.374, when the Container catches a non application exception, it rollbacks the transaction (assumed the method runs in a valid transactional context) and throw java.rmi.RemoteException to remote client.
Thanks for any light on this topic,
Regards,
Cyril.
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that's right. As you said:"... when the Container catches a non application exception, it rollbacks the transaction...", but in this case, the container will throw a more specific exception - TransactionRollbackException, which is the subclass of RemoteException, rather than RemoteException. Hope that will help.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Container should throw the javax.transaction.TransactionRolledbackException to a remote client if the bean instance executed in the client�s transaction. As this exception IS-A java.rmi.RemoteException, then I'd say that the answer is wrong.
 
stable boy
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm unsure that the container should throw an TransactionRollbackException. This depends on the Container.
However I do agree that the container throws a java.rmi.RemoteException when the container performs a rollback.
We have updated the question accordingly.
This is the updated question:

Which of the following statements are true when a session bean's client receives a java.rmi.RemoteException? [Check all correct answers]
The client will never receives a java.rmi.RemoteException.
The client calls the session bean from another JVM. [Correct]
The client calls the session bean from within the same JVM.
The container throws a java.rmi.RemoteException if the container performs a transaction rollback. [Correct]
The throws clauses of all methods in the remote home and component interface must declare a java.rmi.RemoteException. [Correct]
 
Alibabra Sanjie
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think "The client calls the session bean from within the same JVM." is also correct because nothing prevent you from using the session bean within the same JVM as a remote object and using its remote interface. In fact in the old version of EJB, it didn't have local interface, the EJB bean always treated as remote object and used remote interface only.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm unsure that the container should throw an TransactionRollbackException. This depends on the Container.


Section 18.3.3 of EJB 2.0 spec says: "If the exception or error happened during the processing of a client invoked method, throw the
java.rmi.RemoteException to the client if the client is a remote client or throw the javax.ejb.EJBException to the client if the client is a local client. If the instance executed in the client�s transaction, the Container should throw the javax.transaction.TransactionRolledbackException to a remote client or the
javax.ejb.TransactionRolledbackLocalException to a local client, because it
provides more information to the client".
Therefore, another option in the question can be something like this:
The Container should throw the javax.transaction.TransactionRolledbackException to a remote client if the instance executed in the client�s transaction.
 
Your buns are mine! But you can have this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic