Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RemoteException vs EJBException  RSS feed

 
Raghothaman Nagarajachar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
In EJB 2.0 specification, it is mentioned that the use of java.rmi.RemoteException was deprecated for container-invoked callbacks (like ejbCreate, ejbPassivate, ejbActivate) and must use javax.ejb.EJBException instead.
But when I create a new EJB 2.0 component with java.rmi.RemoteException, build and deployment was successful. Also with javax.ejb.EJBException, build and deployment was successful.
This means can we use either of these exceptions in EJB 2.0....?
Is it not necessary to replace java.rmi.RemoteException with javax.ejb.EJBException ....?
Thanks
Raghu
 
Rahul Mahindrakar
Ranch Hand
Posts: 1869
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In EJB 2.0 specification, it is mentioned that the use of java.rmi.RemoteException was deprecated for container-invoked callbacks (like ejbCreate, ejbPassivate, ejbActivate) and must use javax.ejb.EJBException instead.

The term that is important here is "deprecated". The term deprecated means that it is supported for now, but in future it may no longer be supported.
Thus you have written code that works for now. But in future your code may not work!!!
 
Raghothaman Nagarajachar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your answer.
Will replace RemoteException with EJBException.
 
Rahul Mahindrakar
Ranch Hand
Posts: 1869
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You do not need to throw EJBException as it is a runtime exception.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!