Uploaded image for project: 'OpenEJB'
  1. OpenEJB
  2. OPENEJB-1079

Context#bind not working as expected on InitialContext created by LocalInitialContextFactory

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.0, 3.1, 3.1.1
    • None
    • container system
    • 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")

      Attachments

        Activity

          People

            Unassigned Unassigned
            veithen Andreas Veithen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: