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

The Archive Base Latest Questions

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

I have configured Work Managers on my entity beans that I look up via

  • 0

I have configured Work Managers on my entity beans that I look up via JNDI. The idea behind the change was to multi-thread some of the validation as it can be time consuming, but this requires access to the current transaction.

From my testing, it appears that transactions are not accessible in the worker threads. I would very much like to access the transaction in my worker threads – can I do this?

I was hoping to do something similar to this ExecutionContext where the XID object is passed when work is scheduled, meaning that it inherits the current transaction. Does WebLogic support this?

This is what I have done:

I’ve added a work manager definition to weblogic-ejb-jar.xml as follows:

  <work-manager>
    <name>wm/EJBWorkManager</name>
    <min-threads-constraint>
      <name>EJBWorkManager_MinThreadCount</name>
      <count>5</count>
    </min-threads-constraint>
  </work-manager>

Added a reference on the bean definition in ejb-jar.xml

  <resource-ref>
    <description>Work Manager allows multi-threading of defined units of work.</description>
    <res-ref-name>wm/EJBWorkManager</res-ref-name>
    <res-type>commonj.work.WorkManager</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

Then in my code I have looked up the Work Manager and scheduled some work to execute.

weblogic.transaction.Transaction tx = ( weblogic.transaction.Transaction ) weblogic.transaction.TransactionHelper.getTransactionHelper().getTransaction();
log.info( tx != null ? tx.getXid().toString() : "No Transaction" );
try {
  InitialContext initialContext = new InitialContext();
  WorkManager workManager = ( WorkManager ) initialContext.lookup( "java:comp/env/wm/EJBWorkManager" );
  List<WorkItem> workItems = new ArrayList<WorkItem>(); 
  for ( int i = 0; i < 2; i++ ) {
    Work work = new Work() {
      public void run() {
        weblogic.transaction.Transaction tx = ( weblogic.transaction.Transaction ) weblogic.transaction.TransactionHelper.getTransactionHelper().getTransaction();
        log.info( tx != null ? tx.getXid().toString() : "No Transaction" );
      }
      public boolean isDaemon() {
        return false;
      }
      public void release() {
      }
    };
    workItems.add( workManager.schedule( work ) );
  }
  workManager.waitForAll( workItems, WorkManager.INDEFINITE );
} catch ( NamingException e ) {
  throw new RemoteException( "Error", e );
} catch ( IllegalArgumentException e ) {
  throw new RemoteException( "Error", e );
} catch ( InterruptedException e ) {
  throw new RemoteException( "Error", e );
} catch ( WorkException e ) {
  throw new RemoteException( "Error", e );
}

The output I get is as follows which shows that the transaction is not available in the spawned threads. Is it possible to share this transaction into the worker threads? I thought they had done this as part of JCA 1.5 (JSR 112).

16 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO com.tracegroup.isys.weblogic.beans.session.SimpleEJB - BEA1-0474BACB4707C088B359
16 [[STANDBY] ExecuteThread: '10' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO com.tracegroup.isys.weblogic.beans.session.SimpleEJB - No Transaction
16 [[STANDBY] ExecuteThread: '10' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO com.tracegroup.isys.weblogic.beans.session.SimpleEJB - No Transaction

Edit: I have tried using weblogic.connector.work.WorkManager & javax.resource.spi.work.WorkManager also, but these failed to get returned when performing the JNDI lookup. These do appear to allow an ExecutionContext to be passed to the work manager, allowing the XID to be given. My initial tests with these classes appeared not to work. Perhaps I have missed something?

  • 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-15T12:58:29+00:00Added an answer on June 15, 2026 at 12:58 pm

    Official word from Oracle Support Call:

    Not possible/supported. JTA has a single threaded model.

    The one case where multiple threads can be involved in a single
    transaction is where there’s a call out to a remote server. The remote
    server is enlisted as a sub-coordinator. Even then, the overall flow
    of control is single threaded, so extending this model to a local pool
    of threads wouldn’t buy you anything.

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

Sidebar

Related Questions

I have configured Apache httpd to work as a forward proxy server. How can
I have configured Plone with the following buildout (via http://build.pythonpackages.com/buildout/plone/4.2.x ): [buildout] allow-hosts =
I have configured in following way that spring MVC app using Spring 3.1.1.RELEASE web.xml
I have configured my WCF services to work with SSL but it works ONLY
i have set up a single node hadoop cluster and configured it to work
I have configured some basic routes that are available for all users before they
I have configured WCF service to work with the JSON. I have a problem
I have configured the maven-sql plugin to execute the insert and delete scripts for
I have configured Mod Security on Apache 2.2.21 and i have successfully configured Mod
I have configured the Deployer (.NET Website) for SmartTarget. When I try to publish

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.