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

  • SEARCH
  • Home
  • 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 8517503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:43:10+00:00 2026-06-11T05:43:10+00:00

Today I discovered some unexpected behaviour in EJB. I’ve got MDB with default transaction

  • 0

Today I discovered some unexpected behaviour in EJB. I’ve got MDB with default transaction attribute (REQUIRED) and SLSB with transaction attribute set to REQUIRES_NEW. My MDB calls the SLSB and catch any exception that SLSB can throw. When something realy bad occurres in the SLSB and some subclass of RuntimeException was thrown. Then new transaction, which was created for the SLSB, became marked for rollback. It is a correct behaviour from my point of view. Then MDB catch this exception and perform some action (write a message to log, for example) withour rethrow. But the MDB transaction somehow became marked for rollback too, which seems strange to me. Is this behaviour correct?

To be more precise I can write some code similar to actual one, that produce this behaviour:

@MessageDriven
public class A{

@EJB
private B b;

@Overried
public void onMessage(Message msg){
...
try{
b.process(msg);
} catch (Throwable t){
logger.error("Something gone wrong",t);
}
...
}

And SLSB looks like this:

@EJB
@Stateless
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public class B{
public void process(Message msg){
...
}
}

Problematic task flow looks like this:

  1. Message driven bean onMessage(Message) was called.
  2. Message driven bean perform some actions successful and then invoke B.process(Message) method.
  3. Something bad in B occurred and RuntimeException was thrown.
  4. RuntimeException was wrapped in EJBException and was successfully catched by message driven bean.
  5. Message driven bean onMessage(Message) method was executed completely, but its transaction was marked for rollback.

Can anybody explain this behaviour?
Thanks in advance.

  • 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-11T05:43:11+00:00Added an answer on June 11, 2026 at 5:43 am

    Solution to this problem was found. Actually TransactionAttribute annotation was placed on abstract superclass of B bean and was ignored. EJB runtime environment in WebLogic server ignores annotations from B superclass and uses default REQUIRED attribute. If you have encountered the same problem I can recommend you to read section 13.3.7.1 from EJB 3.1 specfication (you can download it here).

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

Sidebar

Related Questions

I've today discovered some strange behaviour in IE8's implementation of the DOM select element's
I am not particularly new to C/C++ but today I discovered some things that
So today I discovered that c# passes reference types by value by default. This
I discovered containsAll() (a List interface method) during some coding today, and it looks
I've discovered today the app Qype and now I'd like to know how I
Came into the office today to do some more work on my nearly completed
my head hurts today! :) I need some help with rails deployment. I migrated
i discovered today that Windows 7 comes with a very impressive MathPanel utility, for
So we went to implement something today, and discovered that there already is several
I discovered(*) today that, depending on the server, my TSQL commands were case-sensitive, meaning

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.