2 Replies Latest reply on Jan 20, 2007 4:40 PM by Pablo Suralowski

    Cannot instantiate class: org.jnp.interfaces.NamingContextFa

    pieter raemdonck Newbie

      hi,

      I have build an EJB that i deployed on my jBoss application server (version: jboss-4.0.3RC2). I have also written a nice client as end user application (swing client). I use eclip 3.1 as java editor. When I run my client application from within eclips al works fine. My remote bean on the jBoss server gets contacted and I am able to launch all buisness methods from the bean.
      But When I package my client application in an executable jar, the bean can not be contacted. My client jar has contains the jbossall-client.jar.
      The error that I get is =

      Cannot instantiate class: org.jnp.interfaces.NamingContextFactory


      I sure would like to solve this.
      How can I fix this?

      Thanks for reading my issue.

      the code that fails is the following:
       protected Context getInitialContext() throws Exception {
       try{
       Hashtable<String, String> props = new Hashtable<String, String>();
       props.put(
       Context.INITIAL_CONTEXT_FACTORY,
       "org.jnp.interfaces.NamingContextFactory");
       props.put(
       Context.URL_PKG_PREFIXES,
       "org.jboss.naming:org.jnp.interfaces");
       props.put(Context.PROVIDER_URL, "jnp://" + this.Server + ":" + this.Port);
       Context ctx = new InitialContext(props);
       return ctx;
       }catch(Exception e){
      
       BufferedWriter out = new BufferedWriter(new FileWriter("getInitialContext.txt"));
       try {
      
       out.write(e.getMessage());
      
       out.close();
       } catch (IOException ee) {
      
       }
       return null;
       }
       }