Friday, March 02, 2007

JAVA 認證心得 -- SCBCD (13)



  • For remote clients, container should wrap unrecoverable checked exception in a java.rmi.RemoteException.

  • javax.ejb.NoSuchObjectLocalException is thrown when a local client invokes methods on a session bean, which does not exist. java.rmi.NoSuchObjectException remote client.
  • The javax.ejb.ObjectNotFoundException is thrown by a finder method to indicate that the specified EJB object does not exit. [single-row or single EJB object] ONLY
  • javax.transaction.NotSupportedException and javax.transaction.RollbackException are predefined application exceptions. javax.ejb.AccessLocalException (subclass of javax.ejb.EJBException) and javax.transaction.InvalidTransactionException (subclass of java.rmi.RemoteException) are system exceptions
  • The javax.transaction.TransactionRolledbackException exception is not thrown when the session bean's business method calls setRollbackOnly() method of javax.ejb.EJBContext.
  • The container is responsible for rolling back the transaction associated with the method that has thrown system exception
  • The Bean Provider must catch checked system exceptions and re-throw as EJBException.
  • a session bean instance may be removed from the container while in the passivated state. This may occur when the client remains inactive for a long period and the Deployer-specified time-out for the session bean instance is reached or if the container crashes while the bean is in a passivated state. If the client becomes active after the session bean has been removed from the container then any attempt by the client to invoke business methods on the session bean will result in java.rmi.NoSuchObjectException which is a subclass of java.rmi.RemoteException (if the client is a remote client) or javax.ejb.NoSuchObjectLocalException (if the client is a local client). The ejbActivate() method may never be called on a passivated bean

Read more!

No comments: