Custom Thread on Weblogic Server 11g

I need a custom threda on my weblogic server; I cannot use TimerEJB or Delayed MDB since I have to use a 3d library.

I know that custom threads on application server are discouraged; here a related post (4 years old): Why is spawning threads in Java EE container discouraged?

Is it still discouraged? Can I use ExecutorService or Quartz? Or I have to consider only commonj and worker manager?


On Weblogic 11g (EJB3.0) is dicouraged to create "own thread executor" (see also Java EE specification and multi threading) you should use:

  • TimerService


MyEjb {
   public class TimerBean implements TimerRemote {

    TimerService service;

    public void startTimer() {
        Timer timer = service.createTimer(1000,  1000, null);
        System.out.println("Timers set");

    public void handleTimeout(Timer timer) {
        System.out.println("Handle timeout event here...");
  • Delayed MDB
  • WorkManager

**If you cannot use Deleyed MDB or TimerService you need to work with Work Manager **.

Weblogic and Websphere are CommonJ (JSR 237 Timer & WorkManager) compliant; in other words they use a common interface to work with work manager; in weblogic, work managers regulate the life cycle of threads (Servlet, EJB, MDB,..., custom thread).

IMHO do not use ExecutorService since is not under the control of weblogic: if you stop the application (not the server) the threads under weblogic control will stop, the other threads should not terminate; I experienced this problem.

Work Manager

The WorkManager feature in WebLogic Server is dynamic in nature, based on the number of incoming requests the thread pool size automatically re-sizes to maximize the throughput. To work with WorkManager you can access through commonj interface or MBean.


InitialContext ic = new InitialContext();
commonj.work.WorkManager wm = (WorkManager);
ic.lookup(‘java:comp/env/wm/default’); // default work manager


For instance spring has an easy way to attach its own TaskExecutor to comonj worker manager:

<bean id="workManager" class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor">
        <property name="workManagerName" value="java:comp/env/wm/default" />


Quartz works on application servers and with spring they can use work manager


JEE7 introduces Batch (JSR 352). The Batch Applications for the Java Platform API (Batch) provides a programming model for batch applications and a runtime for scheduling and executing jobs.

Executor Service

From java specifications:

Also new in the Java EE 7 platform is the Batch API, which provides a programming model for batch applications and a runtime for scheduling and executing jobs, and the Concurrency Utilities API, which provides asynchronous capabilities by means of managed executor service, managed scheduled executor.

In JEE7 Executor Service has been extended with ManagedExecutorService and ManagedThreadFactory.


   javax.naming.InitialContext ctx = new InitialContext();
   ManagedExecutorService mes = (ManagedExecutorService)

   // Create a set of tasks to perform the account retrieval.
   ArrayList<Callable<MyObject>> retrieverTasks = new ArrayList<Callable<MyObject>>();
   retrieverTasks.add(new MyCallable());

Concluding: Weblogic

See http://www.oracle.com/technetwork/java/restrictions-142267.html

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

  • DeploymentException & Class Not Found on WebLogic Admin Server 11g
    Related: Load external properties files into EJB 3 app running on WebLogic 11 Using Oracle Enterprise Pack for Eclipse, I created an Enterprise Project and named it: PropertiesDemoEAR Also created a PropertiesDemoEARWeb module in which I put this code (inside PropertiesDemoEARWeb / Java Resources / src / com.project.util): package com.project.util; public class PropertiesFileHandler extends ApplicationLifecycleListener { private static final String FILE = "C:/etc/error.properties"; public void preStart(ApplicationLifecycleEvent evt) { System.out.println("\n\n\t\tInside preStart() method\n\n")
  • JRE 8 compatibility with weblogic 10.3.6 (11g
    Could you please help in finding out if JRE 8 would be compatible with weblogic 10.3? We have a swing based application deployed on weblogic 10.3 server. We want to upgrade our JRE so wanted to check if JRE 8 would be able to run apps deployed on weblogic 10.3
  • Jboss Seam: Enabling Debug page on WebLogic 10.3.2 (11g)
    SKIP TO UPDATE 3 I want to enable the Seam debug page on Weblogic 10.3.2 (11g). So, I have done the following: I have the jboss-seam and jboss-seam-debug jars as dependency in both my ejb and web maven projects (both are modules of my superproject) I put this context parameter in my web.xml: <context-param> <param-name>org.jboss.seam.core.init.debug</param-name> <param-value>true</param-value> </context-param> Now, when I hit the URL of my application, I get the debug page with this exception (full stacktrace at the end of the post): Caused by java.lang.IllegalStateException with message: "No
  • Solaris JMS Client connect to Weblogic 11g t3s security problem
    When I try to connect Weblogic t3s protocol in Solaris Server, it shows this error: java.lang.IllegalStateException: Not enough cryptography available to enable a cipher suite! at com.certicom.tls.interfaceimpl.TLSSystem.resetCipherSuiteSupport(Unknown Source) at com.certicom.tls.interfaceimpl.TLSSystem.setCertificateSupport(Unknown Source) at com.certicom.tls.interfaceimpl.TLSSystem.<init>(Unknown Source) at com.certicom.tls.interfaceimpl.TLSSystem.<init>(Unknown Source) at com.certicom.net.ssl.SSLContext.<init>(Unknown Source) at com.bea.sslplus.CerticomSSLContext.<init>(Unknown Source) at
  • 【WebLogic】ClassNotFoundException: weblogic.jdbc.wrapper.PoolConnection
    问题描述: weblogic启动web域工程报错如下 用的是oracle19c,jdk1.6,weblogic11g java.lang.Exception: java.rmi.RemoteException: EJB Exception: ; nested exception is: java.lang.AssertionError: java.lang.ClassNotFoundException: weblogic.jdbc.wrapper.PoolConnection 原因分析: 以前,是oracle11g,以为是weblogic11g、jdk1.6和19c不兼容导致; 想着ojdbc14.jar替换为ojdbc6.jar,结果后来发现换了个11g的库也不行 解决方案: 最后发现是jdk1.6本身问题,服务器上的1.6有问题,换了个jdk1.6版本解决了…… 来源:https://blog.csdn.net/yyqjjw/article/details/115331042
  • Jboss Seam:在WebLogic 10.3.2(11g)上启用调试页面(Jboss Seam: Enabling Debug page on WebLogic 10.3.2 (11g))
    问题 跳过更新3 我想在Weblogic 10.3.2(11g)上启用Seam调试页面。 因此,我做了以下工作: 我的ejb和Web Maven项目(都是我的超级项目的模块)中都具有jboss-seam和jboss-seam-debug罐子作为依存关系,我将此上下文参数放在了web.xml中: <context-param> <param-name>org.jboss.seam.core.init.debug</param-name> <param-value>true</param-value> </context-param> 现在,当我点击应用程序的URL时,我得到了带有此异常的调试页面(在文章末尾有完整的stacktrace): 由java.lang.IllegalStateException引起,并带有消息:“当前阶段未绑定任何相位ID(请确保您没有安装两个SeamPhaseListener实例)” 从我阅读的帖子中可以看出,这似乎与类路径中的两个jar包jboss-seam或jboss-seam-debug有某种关系。 我打开了我的耳朵文件,但每个文件中只有一个(耳朵里),而战争本身在WEB-INF / lib中没有库。 我还阅读了使用components.xml初始化调试页面的另一种方法。 我还尝试在WEB-INF中包含以下components.xml,但它也不起作用
  • How do I have weblogic reload cached JSPs on restart
    Our method of deploying a new version of an app for weblogic (11g) is to copy over top of the existing ear file and then stop and restart the weblogic server. We do a start/stop of weblogic rather than a redeployment, because of the known permgen issue (where eventually we will run out of perm gen and have to bounce the weblogic server). However, this method of deploying has a drawback-- new JSP versions are not seen by weblogic. In order to fix this we have had to wipe out the contents of the tmp directory that maintain a cache of the compiled JSPs prior to restarting the server. Is there a
  • 如何在Eclipse中使用Weblogic? [关闭](How to work with Weblogic in Eclipse? [closed])
    问题 关门了。 这个问题需要更加集中。 它当前不接受答案。 想要改善这个问题吗? 更新问题,使其仅通过编辑此帖子即可将重点放在一个问题上。 2年前关闭。 改善这个问题 eclipse与weblogic配合使用的推荐插件是什么? 具体来说,我需要使用旧版本的weblogic 8.1,但是我可以使用任何版本的Ecplise。 我想调试应用程序并设置断点等。 我的更大任务是将项目移至Jboss,我是否可以在Eclipse中的两个应用程序服务器上部署相同的应用程序,大概需要两套配置文件,等等,有什么建议吗? 2个独立的项目? 回答1 如果将Eclipse与WTP一起使用,则可以通过其他服务器适配器使用Weblogic Integration。 要获取它,请右键单击“服务器”视图,然后选择“新建”>“服务器” ,然后单击“下载其他服务器适配器” 。 从列表中选择Oracle扩展,然后继续安装。 安装后,您将能够从8.1版到11g添加用于WebLogic的新服务器(对于BEA WebLogic Server v8.1,请在BEA System,Inc.下查看)。 替代文字http://blogs.oracle.com/gstachni/WindowsLiveWriter/DevelopingApplicationsforWeblogicServer1_C379/image_thumb.png
  • RuleBaseLoader loadFromInputStream drools 2.5 compilation error on Java8 and weblogic12c
    We are facing compilation error while compiling Rule Base from DB on server using drools-io-2.5.jar. RuleBaseLoader.loadFromInputStream(stream); stream is XML input stream picked from database. This code is working with JAVA6 and weblogic 11g but we start getting error when we deployed on weblogic 12c on JAVA8. Can someone please give a direction, how to resolve this. Error: <09-09-2020 18:12:47.235> <DEBUG> <ejbframework> <system> <RulesHelper> <subscriber-type-rules Checking rule base: subscribertypemapping> <09-09-2020 18:12:47.237> <DEBUG> <ejbframework> <system> <RulesHelper> <subscriber
  • How to deploy the same web application twice on WebLogic 11g?
    We have developed a JEE5 web application (WAR) and running it in production under WebLogic 11g (10.3.5). Now the same application should be deployed as separate applications for different customers (different URLs, different data) on the same WebLogic. I managed the first part by setting different context roots after deployment for each of them. But I have yet to make them use different datasources - and since I want to avoid customer specific builds, the persistence.xml is the same for all applications, thus also the persistence unit name. What is the best setup for this scenario? Am I forced
  • How can i solve a NoClassDefFoundError?
    I have installed Oracle Weblogic 11g on Oracle Linux and I tried to complete one of Oracle's ADF tutorials using jdeveloper 11g. When I run my project it compiles successfully with no errors. It starts deploying the application to the weblogic server and my default internet browser opens. But then an Error "500 Internal server error" appears. I'm getting the following error: java.lang.NoClassDefFoundError: Could not initialize class org.apache.myfaces.trinidadinternal.convert.ColorConverter at.... I researched the internet for this problem and I also asked around and the common answer was that
  • Weblogic upgrade to 12c: deployment fails because url mapped to multiple servlet
    I've recently setup a new Weblogic 12c environment. On deploying an application that I know works in Weblogic 11g I get the error "The url-pattern /resources/* in web application is mapped to multiple Servlets." The mapping it's referring to is in the web.xml inside the application.ear that's being deployed, but it's only mapped once: <servlet-mapping> <servlet-name>velocity</servlet-name> <url-pattern>/resources/*</url-pattern> </servlet-mapping> The project doesn't contain any other references to the url pattern /resources/*, can someone explain where the duplicated mapping is coming from
  • Weblogic10.3.6升级2020年7月补丁p31178492_1036_Generic.zip实践
    操作系统:Windows JDK版本:jdk1.6Weblogic版本: 补丁:p31178492_1036_Generic.zip (文章结尾标有修复的内容)说明:Windows升级操作与Linux基本相通,此次实践操作亲测有效,本文仅供参考。 不多说直接开整 一、解压补丁 将补丁p31178492_1036_Generic.zip 解压到 D:\Oracle\Middleware\utils\bsu\cache_dir目录中 二、修改参数 修改D:\Oracle\Middleware\utils\bsu\bsu.cmd中的参数 set MEM_ARGS=-Xms1024m -Xmx4096m 三、查看升级前版本信息 cd D:\Oracle\Middleware\utils\bsu> bsu.cmd -view -status=applied -prod_dir=D:\Oracle\Middleware\wlserver_10.3 -verbose 四、开始执行补丁升级 cd D:\Oracle\Middleware\utils\bsu> bsu.cmd -install -verbose -patch_download_dir=D:\Oracle\Middleware\utils\bsu\cache_dir -patchlist=I37G -prod_dir
  • Adding custom object to JNDI on Weblogic 10
    Is it possible to add a custom object (String or URL) to JNDI using Weblogic Server Administration Console (Weblogic 10.0) or by editing server's configuration file (config.xml)?
  • Weblogic is slow to start (11mins) under VM (VirtualBox and VMware)
    (SOLVED! BY FAKING SYSTEM RANDOM GENERATOR, SEE BELOW) I'm setting up a VM image for my dev/build team. Inside that VM a Weblogic domain should be running. I use Ububtu server distro, WLS 9.2MP3 + ALSB. Everything works OK, quite fast, but at the start time the WLS stops twice for a measurable amounts of time. Two stops in total amount to about 10 minutes delay. For tasks where deployment requires server restart it's very annoying. :-( Sleeping time is not constant, sometimes the server starts very fast, sometimes so-so, sometimes 10 minutes or more. Interesting that if I press Enter while
  • Java : how to check current Perm / PermGen Size?
    Yesterday when I was running the WebLogic Application Server 11g installer, I encountered a OutOfMemory error, so I Googled for the answer: java -Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m -jar wls1032_generic.jar Everything worked :) However, when I think twice about the solution, I might have made a mistake: How could I know the current settings of those? I certainly need to check their values before overriding them, right? Any thoughts? Related link: People in another thread on SO suggested trial and error approach, which is not ideal. Many thanks in advance.
  • Custom arguments to set in Weblogic JVM
    I need a custom property to set per each server JVM in Weblogic. What is the better approach doing it? I know we can specify the argments like below: In the Domain Structure pane, expand the Servers node. Click the name of the server that you want to configure. In the right pane, click Server Start. Select Lock & Edit. In the Arguments text box, provide the JVM options. After inserting your options, click Save. Then click Activate Changes. Restart the server so that the new settings are used. My question is how exactly the argument is defined? How to use that argument inside the application
  • weblogic下的sl4j / logback(sl4j/logback under weblogic)
    问题 我正在尝试在Weblogic12下配置sl4j / logback。 我部署了带有war文件的ear文件,其中war文件具有WEB-INF \ classes \ logback.xml 这是配置: <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> </encoder> </appender> <root level="debug"> <appender-ref ref="STDOUT" /> </root> </configuration> 我要记录的代码: private static final Logger logger = LoggerFactory.getLogger(FrontEndServlet.class); //...... logger.info("info test"); logger.debug("debug test"); logger.error("error test"); 我在标准输出中看到的是: ьрщ 14, 2012 5:09:29 PM .....FrontEndServlet
  • 无法从Weblogic访问HTTPS(Cannot access HTTPS from Weblogic)
    问题 Weblogic访问HTTPS服务器时遇到问题,我可以访问其他HTTPS网址,例如google或microsoft。 尝试连接到url的代码是: URL url = new URL("https://myserver.com"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("User-Agent", "Mozilla/5.0"); // fails here responseCode = connection.getResponseCode(); 我得到以下堆栈跟踪: java.io.IOException: Connection closed, EOF detected at weblogic.socket.JSSEFilterImpl.handleUnwrapResults(JSSEFilterImpl.java:539) at weblogic.socket.JSSEFilterImpl.unwrapAndHandleResults(JSSEFilterImpl.java:456) at weblogic.socket
  • Java EE规范和多线程(Java EE specification and multi threading)
    问题 我正在使用Struts和Spring编写Java EE应用程序。 在一项操作中,存在繁重的数据库处理,因此会出现性能问题。 我想知道的是我可以在这里使用多线程吗? 我认为Java EE规范不允许创建除服务器创建的自定义线程之外的线程(我使用Weblogic)。 请通过这个指导我。 回答1 这个问题有时会弹出。 根据规范,它未经授权。 最好看的页面是以下页面:Q / A:J2EE限制 也就是说,有多种方法可以生成线程,特别是在Weblogic中使用WorkManager生成线程。 看到以下问题: EJB如何并行化耗时长的CPU进程? 为什么不鼓励在J2EE容器中生成线程? J2EE程序员不写入文件 第一个针对EJB的事实并不重要,而最后一个关于访问文件系统的事实则是关于一般限制的。 希望能帮助到你。 回答2 建议在Java EE环境中创建线程的方法是使用Concurrency Utils API,它是EE7规范的一部分。 通过使用此API,将创建新线程并由容器管理它,从而确保所有EE服务都可用于您的线程(例如安全性,事务)。 下面的示例取自我自己的网站,这里和这里 使用ManagedExecutorService 要使用ManagedExecutorService创建新线程,请首先创建一个实现Callable的任务对象。 在call()方法内