0 Replies Latest reply: Feb 27, 2013 4:23 PM by 969283 RSS

    Weblogic Global JNDI Access Error

    969283
      Attempting to access a global JNDI entry from a clustered Weblogic 12c environment. Any attempt to perform a lookup of an object listed under the global JNDI entry (java:global) causes a java.lang.AssertionError exception with a "Context may not be null" message. Lookup of other JNDI objects works as expected.

      The following is a copy of remote test code used to reproduce the problem. It iterates through the root NameClass pairs of the InitialContext retrieved. When it performs a lookup for the "java:global" entry it throws the mentioned exception & message. It has been tested with and without SECURITY_ details with no difference.

      Hashtable<String, Object> environmentValues = new Hashtable<String, Object>();
      environmentValues.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
      environmentValues.put(Context.PROVIDER_URL, "t3://ServerName:port");
      environmentValues.put(Context.SECURITY_PRINCIPAL, "userId");
      environmentValues.put(Context.SECURITY_CREDENTIALS, "password");
      try {
           InitialContext jndi = new InitialContext(environmentValues);
           NamingEnumeration<NameClassPair> namingEnumerations = jndi.list("");
           while(namingEnumerations.hasMore()) {
                NameClassPair ncp = namingEnumerations.next();
                System.out.println(ncp.getName() + " - " + ncp.getClassName());
                Object obj = jndi.lookup(ncp.getName());
                System.out.println("Object '" + ncp.getName() + "' lookup successful.");
           }
      } catch(Exception e) {
           e.printStackTrace();
      }