views:

112

answers:

2

I have this code:

@PersistenceContext(name="persistence/monkey", unitName="deltaflow-pu")
...
@Stateless
public class GahBean implements GahRemote {

But when I use this:

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();}

I get this exception:

javax.naming.NameNotFoundException: No object bound to name java:comp/env/persistent/monkey

If I remove the lookup the iterator doesn't have anything close to it either. What could be the problem?

A: 

If I inject it by the way it works fine, but everywhere I read about that they say it isn't threadsafe to do it that way.

arinte
+1  A: 

This could be my ignorance about JPA showing, but you appear to have "persistence" in some places and "persistent" in others. I'd start by making sure the names match.

CapnNefarious