Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remote Exception or EJB Exception to remote client??

 
Satya P
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In "Orielly EJB 3.0 book" page 399, para 1 it is said as follows:
---------
In session beans, when a system exception occurs and the instance is discarded, a RuntimeException is always thrown whether the client is a remote or a local invocation. If the client started the transaction, which was then propagated to the EJB, a system exception (thrown by the enterprise bean method) will be caught by the container and rethrown as a javax.ejb.EJBTransactionRolledbackException . EJBTransactionRolledbackException is a subtype of RuntimeException and gives a more explicit indication to the client that a rollback occurred. If the client did not propagate a transaction to the EJB, the system exception will be caught and rethrown as an EJBException.
---------

Whereas in Table 16-1 , page 402, a cntradicting statement is made
-------------
Remote client recieve the remote exception or EJB exception.
---------------

Which is correct?
Is Remote Exception thrown or EJB exception to a Reote client?
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the foot notes from the specs, you should find that if your remote interface extends java.rmi.Remote, you get RemoteException instead of EJBException.
 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried the scenario using code.

I created a remote session bean. I threw system exception from my bean. But in all the cases I get EJBException. Even if interface extends Remote, it still threw EJB Exception. Why is Remote Exception thrown?
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably, the best thing is posting your code...
 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Result: I get EJB Exception on remote client. Should'nt I get Remote Exception as my interface is entending Remote?

My App server is JBOSS.

Thanks in advance
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic