I got following error when tried EJB client API approach:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
        at javax.naming.InitialContext.getEnvironment(InitialContext.java:544)
 
Here is the code that thrown exception:
try {
            final Hashtable<String, String> jndiProperties = new Hashtable();
            jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
                ctx = new InitialContext(jndiProperties);
            } catch (NamingException ex) {
                throw new RuntimeException("Could not create initial context using supplied context properties", ex);
            }
        }
        
 try {
      logger.info("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ CTX: " + ctx.getEnvironment().toString());  // It is thown at this line
  } catch (NamingException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
  }
 
 return ctx;
 
jboss-ejb-client.properties:
endpoint.name=client-endpoint
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
 
remote.connections=default
 
remote.connection.default.host=localhost
remote.connection.default.port = 8080
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
 
remote.connection.default.username=admin
remote.connection.default.password=admin
 
What's wrong here?