1

EJB3.0 jboss5.1AS を使用しています

以前は発生しなかった奇妙な問題があります。ejb ステートレス Bean をテストしようとしています。

私は耳の内側(WARプロジェクトの内側)ですべて正常に機能するサーブレットからのejb呼び出しをシミュレートしていました。

ここで、EJB 呼び出しを実行して、外部 tomcat サーバーから EAR の外部にあるサーブレットを介してこの ejb をテストしようとします。

そして突然、私はこの例外を受け取ります:

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 

....

私はこの方法でタイマーをトリガーしています:

@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");
         }
     ..
     }

私はこの方法で 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();
        }
4

1 に答える 1

0

すべての jboss クライアント jar を tomcat/jboss 側に追加する必要があります。

于 2012-06-17T07:18:41.033 に答える