我有一个问题,而试图调用我的ejb3存在于JBoss 7模块从我的战争文件。请查看以下详细信息-
本地接口-
package com.uniteller.switchcore.cs.iface;
import javax.ejb.Local;
import javax.ejb.Remote;
@Local
public interface CSTimer {
public boolean init( );
}
EJB: package com.uniteller.switchcore.cs.impl;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
@Stateless
@LocalBean
public class CSTimerBean implements CSTimer {
public CSTimerBean() {
// TODO Auto-generated constructor stub
}
@Override
public boolean init() {
//Some log statements
}
}
接口和bean都在jboss旁边,作为Switch.jar中的7模块(JBOSS_HOME/modules/com.xxx.switch.main)。
现在我的问题是,我正试图从战争(SwitchMain.war)调用它,但得到以下异常-
12:50:41,593 ERROR [stderr] (MSC service thread 1-4) javax.naming.NameNotFoundException: ejb:/UFSwitch/CSTimerBean!com.uniteller.switchcore.cs.iface.CSTimer -- service jboss.naming.
请帮我解决这个问题。
提前感谢。
您可以尝试通过添加@LocalBinding(jndiBinding = " CSTimerBean ")在bean类中。请参考此链接以验证如何调用接口,调用http://docs.jboss.org/ejb3/docs/tutorial/1.0.7/html/JNDI_Bindings.html