6 Replies Latest reply on Feb 19, 2004 3:48 PM by Aldo Martinez


    sp4rk Newbie

      hey people

      I'm trying to run a very simple EJB to test my setup but i cant get past this naming error. My application is deployed correctly on jboss 3.0.6.

      I try and run the client using the following command:

      java -classpath c:\java\jboss-tomcat\client\*.jar;. Client "hello"

      and i get the following error:

      javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory

      my jndi.properties file is on the server/default/conf folder on jboss and looks as follows:


      Below is my Bean:

      import javax.naming.*;
      import javax.rmi.PortableRemoteObject;
      import java.util.Properties;
      import com.javapro.ejb.StringProcessor;
      import com.javapro.ejb.StringProcessorHome;

      public class Client {

      public static void main(String[] args) {

      // first argument must be the input
      if (args.length==0) {
      System.out.println("Please specify the input to convert to upper case.");
      String input = args[0];

      // preparing properties for constructing an InitialContext object

      Properties properties = new Properties();
      properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      properties.put(Context.PROVIDER_URL, "localhost:1099");

      try {
      // Get an initial context
      InitialContext jndiContext = new InitialContext(properties);
      System.out.println("Got context");

      // Get a reference to the Bean
      Object ref = jndiContext.lookup("StringProcessor");
      System.out.println("Got reference");

      // Get a reference from this to the Bean's Home interface
      StringProcessorHome home = (StringProcessorHome)
      PortableRemoteObject.narrow (ref, StringProcessorHome.class);

      // Create an Adder object from the Home interface
      StringProcessor sp = home.create();
      System.out.println ("Uppercase of '" + input + "' is " +
      catch(Exception e) {

      I've looked everywhere for a solution without luck, I'm sure its something very simple, any ideas?