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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:04:39+00:00 2026-05-13T11:04:39+00:00

I have to execute long running threads in a WebLogic Bea 10.0 M1 server

  • 0

I have to execute long running threads in a WebLogic Bea 10.0 M1 server environment. I tried to use WorkManagers for this. Using an own WorkManager allows me to specify my own thread timeout (MaxThreadStuckTime) instead of adjusting the timeout for the whole business application.

My setup is as follows:

weblogic-ejb-jar.xml:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">

    <weblogic-enterprise-bean>
        <ejb-name>TestBean</ejb-name>
        <resource-description>
            <res-ref-name>myWorkManager</res-ref-name>
            <jndi-name>wm/myWorkManager</jndi-name>
        </resource-description>
    </weblogic-enterprise-bean>

</weblogic-ejb-jar>

weblogic-application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic xmlns="http://www.bea.com/ns/weblogic/90" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
    http://www.bea.com/ns/weblogic/90/weblogic.xsd">

    <work-manager>
        <name>myWorkManager</name>
        <ignore-stuck-threads>1</ignore-stuck-threads>
    </work-manager>

</weblogic>

and the Bean:

import javax.annotation.Resource;
import javax.ejb.Stateful;

import weblogic.work.WorkManager;

@Stateful(mappedName = "TestBean")
public class TestBean implements TestBeanRemote {

    @Resource(name = "myWorkManager")
    private WorkManager myWorkManager;

    public void test() {
        myWorkManager.schedule(new Runnable() {

            public void run() {
                while (true) {
                    System.out.println("test: +++++++++++++++++++++++++");
                    try {
                        Thread.sleep(45000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }

            }
        });
    }
}

When I try to deploy this things, the server gives me the following exceptions:

[EJB:011026]The EJB container failed while creating the java:/comp/env namespace for this EJB deployment.
weblogic.deployment.EnvironmentException: [EJB:010176]The resource-env-ref 'myWorkManager' declared in the ejb-jar.xml descriptor has no JNDI name mapped to it. The resource-ref must be mapped to a JNDI name using the resource-description element of the weblogic-ejb-jar.xml descriptor.

I try to figure out how to access / use WorkMangers for days now, and still get this or that as an exception. Very frustrating!

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-05-13T11:04:40+00:00Added an answer on May 13, 2026 at 11:04 am

    You need to remove the WorkManager refrence from your weblogic-ejb-jar.xml, this refenece should go to ejb-jar.xml.

    Infact I doubt if Weblogic schema definition “weblogic-ejb-jar.xsd” will allow you to add a reference element, you must be getting xsd validation errors.

    anyways, get rid of the element

    resource-description from weblogic-ejb-jar.xml

    <weblogic-enterprise-bean> 
        <ejb-name>TestBean</ejb-name> 
        <resource-description> 
            <res-ref-name>myWorkManager</res-ref-name> 
            <jndi-name>wm/myWorkManager</jndi-name> 
        </resource-description> 
    </weblogic-enterprise-bean> 
    

    it will look like this

    weblogic-ejb-jar.xml

    <weblogic-enterprise-bean>
        <ejb-name>TestBean</ejb-name>
    </weblogic-enterprise-bean>
    

    your workManager reference will go to ejb-jar.xml like this.

    ejb-jar.xml

     <enterprise-beans>
        <session>
            <ejb-name>TestBean</ejb-name>
            <ejb-class>com.xxx.TestBean</ejb-class> <!-- your package com.xxx-->
            <resource-ref>
                <res-ref-name>myWorkManager</res-ref-name>
                <res-type>commonj.work.WorkManager</res-type>
                <res-auth>Container</res-auth>
            </resource-ref>
        </session>
    </enterprise-beans>
    

    Now to get WorkManager from JNDI I’m doing

    InitialContext ctx = new InitialContext();
    this.workManager = (WorkManager) ctx.lookup("java:comp/env/myWorkManager");
    

    but I belive annotation will work equally well.

    @Resource(name = "myWorkManager")
    

    my weblogic-application.xml looks same as shared above

    <weblogic> 
    <work-manager> 
        <name>myWorkManager</name> 
        <ignore-stuck-threads>1</ignore-stuck-threads> 
    </work-manager> 
    

    This is working for me .. let me know if needed I can share my full code.

    you can view your WorkManager and load on it by going to Weblogic Admin Console
    Home—>Deployments—>yourApp—>Monitoring(Tab)—>WorkLoad(Tab)”

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

Sidebar

Related Questions

No related questions found

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.