简体   繁体   English

无法在Jboss5上创建计时器

[英]Failed to create timer on Jboss5

I am using EJB3.0 jboss5.1AS 我正在使用EJB3.0 jboss5.1AS

I have some weird problem which didnt happen before. 我有一些以前没有发生过的奇怪问题。 I am trying to test my ejb stateless bean. 我正在尝试测试我的ejb无状态bean。

I used to simulate ejb call from a servlet which inside my ear(inside WAR project) and everything worked fine. 我曾经模拟了一个servlet的ejb调用,该servlet在我的耳朵内(在WAR项目中),并且一切正常。

now we try to test this ejb via servlet which is outside the EAR from an extrnal tomcat server by doing EJB-call 现在,我们尝试通过EJB调用,通过外部tomcat服务器在EAR之外的servlet来测试此ejb

and all of a sudden I get this exception: 突然我得到了这个例外:

7 May 12 13:13:11, ERROR DispactherBean:dispatchMsg:113 Exception. The error msg=Failed to create timer
javax.ejb.EJBException: Failed to create timer
    at org.jboss.ejb.txtimer.TimerServiceImpl.createTimer(TimerServiceImpl.java:263)
    at org.jboss.ejb.txtimer.TimerServiceImpl.createTimer(TimerServiceImpl.java:171)
    at org.jboss.as.ejb3.timerservice.TimerServiceFacade.createTimer(TimerServiceFacade.java:83)
    at DispactherBean.dispatchMsg(DispactherBean.java:94)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 

.... ....

I am triggering my timer this way: 我这样触发计时器:

@Stateless
@Remote(
{ DispactherBeanRemote.class })
@RemoteBinding(jndiBinding = "DispactherBean")
public class DispactherBean implements DispactherBeanRemote, Serializable
{

    private static final long serialVersionUID = 1L;
    private final static Logger logger = Logger.getLogger(DispactherBean.class);

    @Resource
    private TimerService timerService;

         public void someMethod()
         { 

            timerService.createTimer(MomConstants.TRX_TIMEOUT_PERIOD,"test");
         }
     ..
     }

I am calling this bean from tomcat/standalone this way: 我这样从tomcat / standalone调用此bean:

Properties p = new Properties();
            p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
            p.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
            p.put(Context.PROVIDER_URL, "jboss.ip:1099"); 
            InitialContext context = new InitialContext(p);
            String lookupStr = "Mom/DispactherBean/remote-mom.beans.DispactherBeanRemote";

            DispactherBeanRemote dispactherBean = (DispactherBeanRemote) context.lookup(lookupStr);                 
        dispactherBean.someMethod();

        }
        catch (Exception e)
        {
            e.printStackTrace();
        }

需要将所有jboss客户端jar添加到tomcat / jboss端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM