如何解决 - JBAS014516:无法在5分钟内获得许可

时间:2017-06-02 05:42:53

标签: ejb threadpool ejb-3.1 jboss6.x

我目前面临的是JBAS014516:未能在5分钟内获得许可证'我的EJB-JBOSS配置问题.Below是我的配置 -

<subsystem xmlns="urn:jboss:domain:ejb3:1.4">
        <session-bean>
            <stateless>
                <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
            </stateless>
            <stateful default-access-timeout="5000" cache-ref="simple"/>
            <singleton default-access-timeout="5000"/>
        </session-bean>
        <mdb>
            <resource-adapter-ref resource-adapter-name="hornetq-ra"/>
            <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
        </mdb>
        <pools>
            <bean-instance-pools>
                <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
                <strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
            </bean-instance-pools>
        </pools>
        <caches>
            <cache name="simple" aliases="NoPassivationCache"/>
            <cache name="passivating" passivation-store-ref="file" aliases="SimpleStatefulCache"/>
            <cache name="clustered" passivation-store-ref="abc" aliases="StatefulTreeCache"/>
        </caches>

        <async thread-pool-name="default"/>
        <timer-service thread-pool-name="default">
            <data-store path="timer-service-data" relative-to="jboss.server.data.dir"/>
        </timer-service>
        <remote connector-ref="remoting-connector" thread-pool-name="default"/>
        <thread-pools>
            <thread-pool name="default">
                <max-threads count="10"/>
                <keepalive-time time="100" unit="milliseconds"/>
            </thread-pool>
        </thread-pools>
        <iiop enable-by-default="false" use-qualified-name="false"/>
        <default-security-domain value="other"/>
        <default-missing-method-permissions-deny-access value="true"/>
    </subsystem>

要解决此问题,我应该增加&#39; strict-max-pool&#39;更高的值或增加线程池大小。

1 个答案:

答案 0 :(得分:3)

如果不了解您的用例,很难建议一个好的方法,但很可能您在EJB bean上调用一个方法,执行时间太长,逐渐耗尽池中的实例,直到没有剩下对于调用者进程。随着越来越多的对此操作的请求进入,EJB容器将尝试向客户端提供池中的下一个免费项目。通常,如果bean实例上的操作完成,则实例将返回到池中,并可用于下一个客户端调用。如果操作需要很长时间,则池将耗尽,直到没有可用的实例来为客户端调用提供服务。根据您的配置,EJB容器有20个实例;如果没有,它将尝试等待5分钟,是否某些实例不会返回到池中。如果在该时间内未能获取实例,则会将上述错误抛给调用者 那么这导致我们: 首先,分析花费那么长时间的EJB操作(向部署中添加一个简单的EJB拦截器非常有用,它可以跟踪EJB调用的开始和结束以及跟踪执行时间)
确定谁调用该EJB实例 - 可能它正在对该bean进行过多的调用。
如果无法避免或优化长时间运行的操作,请增加池大小,以便客户端可以使用该bean的更多实例(调整max-pool-size

如果您的用例需要长时间运行,但需要阻塞并等待其结果,请考虑异步处理和JMS队列 - 在队列中创建作业,然后使用MDB执行它们。您仍然可以通过DB存储和查询处理状态。