我有这个代码:
@PersistenceContext(name="persistence/monkey", unitName="deltaflow-pu")
...
@Stateless
public class GahBean implements GahRemote {
但是当我使用这个时:
try{
InitialContext ic = new InitialContext();
System.out.println("Pissing me off * " + ic.lookup("java:comp/env/persistent/monkey"));
Iterator e = ic.getEnvironment().values().iterator();
while ( e.hasNext() )
System.out.println("rem - " + e.next());
}catch(Exception a){ a.printStackTrace();}
我得到这个例外:
javax.naming.NameNotFoundException: No object bound to name java:comp/env/persistent/monkey
如果我删除查找,迭代器也没有任何接近它的东西。可能是什么问题呢?