title: JBoss 7: JNDI lookup
body: <p>after quite a while I made the remote access to a stateless EJB run under JBoss 7.1.1. using Properties object:</p>
  
  <pre><code>Properties jndiProps = new Properties();
  jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, 
      "org.jboss.naming.remote.client.InitialContextFactory");
  jndiProps.put(Context.PROVIDER_URL,"remote://localhost:4447");
  jndiProps.put(Context.SECURITY_PRINCIPAL, "remote");
  jndiProps.put(Context.SECURITY_CREDENTIALS, "remotepwd");
  jndiProps.put("jboss.naming.client.ejb.context", true);
  Context ctx = new InitialContext(jndiProps);
  
  String lookupString = "//HelloWorld/HelloWorldBean!org.acme.test.HelloWorld";
  HelloWorld hw = (HelloWorld) ctx.lookup(lookupString);
  System.out.println("Response: "+ hw.sayHello("Hi there"));
  </code></pre>
  
  <p>So <strong>this works fine</strong> but now I want to put the JNDI thing into jndi.properties file but failed, this is how the file looks like:</p>
  
  <pre><code>java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
  java.naming.factory.url.pkgs=org.jboss.ejb.client.naming
  java.naming.provider.url=remote://localhost:4447
  java.naming.security.principal=remote
  java.naming.security.credentials=remotepwd
  </code></pre>
  
  <p>The exception:</p>
  
  <pre><code>Exception in thread "main" java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:HelloWorld,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@108c175
  at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)
  at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)
  at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
  at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
  at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
  at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
  at $Proxy0.sayHello(Unknown Source)
  at de.brockhaus.test.client.TestClient.main(TestClient.java:35)
  </code></pre>
  
  <p>I already went through several doco but failed, so how does it have to look like then?</p>