public void runTest() throws Exception {
InitialContext ctx = new InitialContext();
ResourceManager bean = (ResourceManager) ctx.lookup("ejb/ResourceManagerJNDI");
System.out.println(bean.DummyText());
}
您好。所以我正在尝试创建一个EJB应用程序,这是它的测试客户端。 JNDI查找成功但在调用“DummyText”方法时,我收到以下错误:
javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: nested exception is: javax.ejb.CreateException: Could not create stateless EJB; nested exception is:
javax.ejb.EJBException: nested exception is: javax.ejb.CreateException: Could not create stateless EJB (...)
这是bean类的外观:
@Stateless(name="ResourceManager", mappedName="ejb/ResourceManagerJNDI")
@Remote
@Local
public class ResourceManagerBean implements ResourceManager
{
@EJB
private AccessDAO accessDAO;
@EJB
private ResourceDAO resourceDAO;
@EJB
private DepartmentDAO departmentDAO;
(list of methods)
}
任何建议都将不胜感激。谢谢。
答案 0 :(得分:1)
这是我的第一个想法。 你应该有像
这样的东西@Remote
public interface ResourceManagerSessionRemote {
(list of methods)
}
中断远程和本地接口
@Stateless(name="ResourceManager", mappedName="ejb/ResourceManagerJNDI")
public class ResourceManagerBean implements ResourceManagerSessionRemote
{
@EJB
private AccessDAO accessDAO;
@EJB
private ResourceDAO resourceDAO;
@EJB
private DepartmentDAO departmentDAO;
(list of methods)
}