Sbb 无法在 Mobicents JBoss 2.7.0 上启动

Sbb does not start on Mobicents JBoss 2.7.0

我正在使用 mobicents-jainslee-2.7.0.FINAL-jboss-5.1.0.GA,我尝试部署简单的onTimerEvent 服务。 JBoss 正确检测到所有组件,但是当我单击激活时控制台中没有日志。另一方面,onStartedEventSbb 效果很好。

为什么这个服务和 Sbb 不是 运行 服务器?

我有一个TimerSbb.java:

public class TimerSbb implements Sbb {
    private Tracer tracer;
    private SbbContext sbbContext;
    private TimerFacility timerFacility;
    private NullActivityContextInterfaceFactory nullActivityContextFactory;
    private NullActivityFactory nullActivityFactory;

    private final int TIMER_PERIOD_IN_MILISECONDS = 500;

    public void onTimerEvent(TimerEvent timerEvent, ActivityContextInterface activityContextInterface) {
        tracer.info("onTimerEvent");
    }

    public void setSbbContext(SbbContext context) {
        this.sbbContext = context;
        tracer = this.sbbContext.getTracer(getClass().getSimpleName());
        tracer.info("setSbbContext");
        try {
            Context initialContext = new InitialContext();
            timerFacility = (TimerFacility) initialContext.lookup(TimerFacility.JNDI_NAME);
            nullActivityContextFactory = (NullActivityContextInterfaceFactory) initialContext.lookup(NullActivityContextInterfaceFactory.JNDI_NAME);
            nullActivityFactory = (NullActivityFactory) initialContext.lookup(NullActivityFactory.JNDI_NAME);
        } catch (NamingException e) {
            tracer.warning("NamingException", e);
        }
        setupTimer();
    }

    private void setupTimer() {
        ActivityContextInterface nullActivityContext = nullActivityContextFactory.getActivityContextInterface(nullActivityFactory.createNullActivity());
        timerFacility.setTimer(nullActivityContext, null, System.currentTimeMillis(), TIMER_PERIOD_IN_MILISECONDS, 0, new TimerOptions());
        nullActivityContext.attach(sbbContext.getSbbLocalObject());
        tracer.info("Timer set up. Period = " + TIMER_PERIOD_IN_MILISECONDS + " ms");
    }

    public void unsetSbbContext() {
        tracer.info("unsetSbbContext");
    }

    public void sbbCreate() throws CreateException {
        tracer.info("sbbCreate");
    }

    public void sbbPostCreate() throws CreateException {
        tracer.info("sbbPostCreate");
    }

    public void sbbActivate() {
        tracer.info("sbbActivate");
    }

    public void sbbPassivate() {
        tracer.info("sbbPassivate");
    }

    public void sbbLoad() {
        tracer.info("sbbLoad");
    }

    public void sbbStore() {
        tracer.info("sbbStore");
    }

    public void sbbRemove() {
        tracer.info("sbbRemove");
    }

    public void sbbExceptionThrown(Exception e, Object o, ActivityContextInterface activityContextInterface) {
        tracer.info("sbbExceptionThrown");
    }

    public void sbbRolledBack(RolledBackContext rolledBackContext) {
        tracer.info("sbbRolledBack");
    }

}

sbb-jar.xml:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE sbb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD JAIN SLEE SBB 1.1//EN"
        "http://java.sun.com/dtd/slee-sbb-jar_1_1.dtd">

<sbb-jar>
    <sbb>
        <sbb-name>TimerSbb</sbb-name>
        <sbb-vendor>com.example</sbb-vendor>
        <sbb-version>1.0</sbb-version>
        <sbb-classes>
            <sbb-abstract-class>
                <sbb-abstract-class-name>
                    com.example.slee.TimerSbb
                </sbb-abstract-class-name>
            </sbb-abstract-class>
        </sbb-classes>

        <event event-direction="Receive">
            <event-name>TimerEvent</event-name>
            <event-type-ref>
                <event-type-name>javax.slee.facilities.TimerEvent</event-type-name>
                <event-type-vendor>javax.slee</event-type-vendor>
                <event-type-version>1.0</event-type-version>
            </event-type-ref>
        </event>

    </sbb>
</sbb-jar>        

定时器-service.xml:

<service-xml>
<service>
    <service-name>Timer Service</service-name>
    <service-vendor>com.example</service-vendor>
    <service-version>1.0</service-version>
    <root-sbb>
        <sbb-name>TimerSbb</sbb-name>
        <sbb-vendor>com.example</sbb-vendor>
        <sbb-version>1.0</sbb-version>
    </root-sbb>
    <default-priority>0</default-priority>
</service>

可部署-unit.xml:

<deployable-unit>
    <jar>lib/timer-sbb-1.0-SNAPSHOT.jar</jar>
    <service-xml>timer-service.xml</service-xml>
</deployable-unit>

我正在用 Maven 构建 jar:Jar 结构是:

example.jar:

 - lib/timer-sbb-1.0-SNAPSHOT.jar
 - timer-service.xml
 - META-INF/deployable-unit.xml

timer-sbb-1.0-SNAPSHOT.jar:
 - com.example.slee.TimerSbb
 - META-INF/sbb-jar.xml

这个太旧了,你可以使用 https://github.com/RestComm/jain-slee/releases/latest 的最新版本吗?

问题在于通过 TimerFacility 在 setSbbContext 方法中创建计时器。可能还为时过早,如果我将方法 setupTimer() 移至 onServiceStartedEvent() 它会起作用。