我是java的新手并且学习如何实现有状态的ejb,我做不到 - (我想通过在arrayList中添加和删除元素来维护列表)并且单元测试工作正常,初始化对象抛出javax.naming.NamingException
我有什么遗漏。
<%!
private static ListElementRemoteForStateful itemIds;
public void jspInit()
{
try
{
InitialContext ic = new InitialContext();
// next line of code always throw
// here EjbPrototype is the name of the project
// StatefulEjb is the class name which resides in package ejb
// I tested with java:global/EjbPrototype/StatefulEjb
// I tested with java:global/EjbPrototype/ejb.StatefulEjb
// I tested with java:app/EjbPrototype/StatefulEjb
// I tested with java:module/EjbPrototype/StatefulEjb
// I tested with java:comp/EjbPrototype/StatefulEjb but no luck
itemIds = (ListElementRemoteForStateful)ic.lookup("java:global/EjbPrototype/StatefulEjb");
}
catch(Exception e)
{
System.out.println(e);
}
}
%>
我有以下SOQ的接受答案产生的结果