Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.0, 3.1, 3.1.1
-
None
-
None
-
Sun JDK 1.6.0
Description
The following code snippet binds an object under a new name in the "java:comp" context and then tries to do a lookup of this object. It unexpectedly fails with a NameNotFoundException during the lookup:
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
Context context = (Context)new InitialContext(props).lookup("java:comp");
context.bind("test", "Some object");
context.lookup("test");
It appears that instead of binding the object as "java:comp/test", OpenEJB binds it as "java:test", i.e. the object is added as a sibling of the context, not as a child node. This can be easily tested by replacing the last line by:
context.lookup("java:test")