title: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory
body: <p>Here this my code:</p>
  
  <p>SpeakerRemote.java</p>
  
  <pre><code>package test;
  import javax.ejb.Remote;
  
  @Remote
  public interface SpeakerRemote {
      String sayAPhrase( String phrase );
  }
  </code></pre>
  
  <hr>
  
  <p>SpeakerBean.java</p>
  
  <pre><code>package test;
  import javax.ejb.Stateless;
  
  @Stateless
  public class SpeakerBean implements SpeakerRemote {
      @Override
      public String sayAPhrase( String phrase ){
           return "Speaker Service:\t" + phrase;
      }
  }
  </code></pre>
  
  <hr>
  
  <p>I assembled it with maven. Here I show you invoking part:</p>
  
  <p>Invoker.java</p>
  
  <pre><code>import javax.naming.Context;
  import javax.naming.InitialContext;
  import javax.naming.NamingException;
  import java.util.Properties;
  
  public class Invoker {
      public static InitialContext getContext() throws NamingException {
          final Properties properties = new Properties();
          properties.put( Context.INITIAL_CONTEXT_FACTORY,
              "org.jnp.interfaces.NamingContextFactory" );
          properties.put( Context.PROVIDER_URL, "jnp://127.0.0.1:1099" );
          return new InitialContext( properties );
      }
  }
  </code></pre>
  
  <hr>
  
  <p>Main.java</p>
  
  <pre><code>import test.SpeakerRemote;
  import javax.naming.InitialContext;
  import javax.naming.NamingException;
  
  public class Main {
      public static void main( String... args ) {
          try {
              InitialContext context = Invoker.getContext();
              SpeakerRemote speaker = ( SpeakerRemote ) context.lookup( "SpeakerBean/remote" );
              System.out.println( speaker.sayAPhrase( "Hello, World!" ) );
          }
          catch ( NamingException e ) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>Having started this app I received this exception:</p>
  
  <p>"Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]"</p>
  
  <p>Please help me, because I really need to understand it!</p>
  
  <p>P.S. I use jboss 7.1.1 Final + EJB 3.1 + Maven 3.1.1 + Java 1.7 + Win7</p>