0 Replies Latest reply on Sep 11, 2017 10:57 AM by Francesco Marchioni

    WildFly 11 simplified lookup

    Francesco Marchioni Apprentice

      Hi all,

      I'm testing WildFly 11 simplified lookup, by replacing the following code:

      jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY,  "org.wildfly.naming.client.WildFlyInitialContextFactory");
      jndiProperties.put(Context.URL_PKG_PREFIXES,
              "org.jboss.ejb.client.naming");
      jndiProperties.put(Context.PROVIDER_URL,"remote+http://localhost:8080");
      final Context context = new InitialContext(jndiProperties);
      

      with this:

      InitialContext ctx = new WildFlyInitialContext();
      

      However it results in:

      Exception in thread "main" javax.naming.NoInitialContextException
          at org.wildfly.naming.client.WildFlyInitialContext.getDefaultInitCtx(WildFlyInitialContext.java:65)
          at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350)
          at javax.naming.InitialContext.lookup(InitialContext.java:417)
      

      Is it supposed to work in this way, or we should set anyway some properties in the InitialContext ?

      Thanks

      Francesco