Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9153381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:15:47+00:00 2026-06-17T12:15:47+00:00

A quote from the EJB specification: If the bean method encounters a system exception

  • 0

A quote from the EJB specification:

If the bean method encounters a system exception or error, it should
simply propagate the error from the bean method to the container
(i.e., the bean method does not have to catch the exception).

But I don’t understand it. Does it mean that I shouldn’t catch all types of exceptions (i.e. try to catch Exception class) and rethrow it as my application exception?

An example for more clarity:

public void beanMethod throws MyApplicationException {
  try {
    // do something
  } catch (Exception e) {
     throw new MyApplicationException(e); // Should I do it like this? 
  }
}

Or is this not for EJB developers, but only for EJB reference-implementation developers (container developers): In the latter case, as a consequence, the container must not propagate system exceptions to my business method, and my catch(Exception e) block never catches any system exception?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:15:48+00:00Added an answer on June 17, 2026 at 12:15 pm

    There are more type of exceptions:

    • System exceptions (RuntimeExceptions eg. NullPointerException)
    • Business exceptions (your own exception, extends Exception, but not RuntimeException, eg. NotEnoughMoneyOnYourAccountException)
    • Errors (eg. OutOfMemoryError)

    Normally you should catch Business Exceptions. But of course you can throw it to the client side if you want to handle it there. By default the EJB container won’t rollback your transaction if you throw a BusinessException, but you can change this behavior by annotating your Exception the following way:

    @ApplicationException(rollback = true)
    public class NotEnoughMoneyOnYourAccountException extends Exception {
    

    If your program throws a RuntimeException, it will be sent to the client wrapped as a RemoteException, and your transaction will be rolled back. These are less excepted than business exceptions, therefore we usually don’t catch them at EJB side.

    Errors are the least excepted, they can even shut down the JVM, usually we don’t catch them, because usually we cannot handle them in the program.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trying to call some ejb bean method from tread. and getting error :
Quote from hib official docs: Starting with version 3.0.1, Hibernate added the SessionFactory.getCurrentSession() method.
Quote from MSDN: If Finalize or an override of Finalize throws an exception, the
Quote from C# language specification 3.9: '2. If the object, or any part of
A quote from the C++ Primer, 4th edition: The rules for when an exception
A quote from MSDN: http://msdn.microsoft.com/en-us/library/6kac2kdh.aspx One or more managed threads (represented by System.Threading.Thread) can
Quote from Wikipedia : A public key token. This is a 64-bit hash of
Quote from Head first html: You can add padding to the top and bottom
Quote from Jason Coco it not possible to set multiple in UILabel... but how
I would like to trim a beginning and ending double quote () from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.