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 6777717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:10:52+00:00 2026-05-26T16:10:52+00:00

Is it possible to invoke a transactional method from within a Stateful EJB itself?

  • 0

Is it possible to invoke a transactional method from within a Stateful EJB itself? To speak more clearly:

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
@Stateless
public class MyService {

    @Resource
    SessionContext ctx;

    public void myMethod()  {
        // do something...

        // invoke method from the same class

        // As expected - this doesn't work as it's a regular local-call, 
        // it's not aware of EJB nature of this call.
        save();

        // Doesn't work (although it worked with SLSB)
        ctx.getBusinessObject(MyService.class).save();
    }

    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    public void save() {
        // do something...
    }
}

Now what I want to achieve is to let the user call myMethod(); I want to be sure that this method is executed without the JTA transaction. After this call I want to invoke a save(); method which will be run within a transaction.

If I use the ctx.getBusinessObject(-) method I get:

WARNING: A system exception occurred during an invocation on EJB
MyService method public void com.test.MyService.save()
javax.ejb.IllegalLoopbackException: Illegal Reentrant Access : Attempt
to make a loopback call on method ‘public void
com.test.MyService.save() for stateful session bean MyService

Are the inner calls not supported for SFSBs?

I’m running Glassfish 3.1.1.

  • 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-05-26T16:10:53+00:00Added an answer on May 26, 2026 at 4:10 pm

    It might be a bug in the Glassfish EJB implementation. It doesn’t just happen when you call a method with a different transaction attribute, it happens with every reentrant call to a stateful session bean.

    Just try putting a simple test method in your stateful bean and call it via the business object proxy. You’ll get the same exception.

    On JBoss AS 7, reentrant calls to stateful beans are allowed. Incidentally, a similar bug was present in OpenEJB some time ago: https://issues.apache.org/jira/browse/OPENEJB-1099

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

Sidebar

Related Questions

Is it possible to invoke method A.F() from instance of B class except of
Is it possible in Delphi to have a class method invoke an inherited instance
is it possible to invoke .jnlp file from java code? Example: Process p =
Is it possible to invoke Java EE web services from iPhone? and how?
I am trying to invoke an internal method from a dynamically generated one. The
Possible Duplicates: Does the 'offsetof' macro from <stddef.h> invoke undefined behaviour? dereferencing the null
Is it possible to call a .NET method from PowerShell with early binding? I
is it possible to invoke a delegate method of a class by code? In
Is it possible to somehow invoke a non-global function (i.e. a method of a
Is it possible to invoke a method where property is expected in JSF 2.0

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.