3 Replies Latest reply on Feb 20, 2004 8:43 AM by Aldo Martinez

    Cannot instantiate class: org.jnp.interfaces.NamingContextFa

    Aldo Martinez Newbie

      I know others ask this before... but still can't solve the problem....

      I'm trying to make a simple client to access a ejb in jboss.... when i run it from eclipse it runs perfect... but when i make the jar and try tu run it i get:

      javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
      at javax.naming.InitialContext.init(InitialContext.java:219)
      at javax.naming.InitialContext.(InitialContext.java:175)
      at p.Client.main(Client.java:36)
      Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
      at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:219)
      at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)
      ... 4 more

      I did everything i saw in the forums... but still the same....

      the code in the client is:

      System.setProperty( "java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
      System.setProperty( "java.naming.provider.url","jnp://localhost:1099");
      System.setProperty( "java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
      Context ctx = new InitialContext( );

      Also i have the jndi.properties:
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url=jnp://localhost:1099
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

      and in the classpath i have jbossall-client.jar, jndi.jar, jnp-client.jar, etc....

      any ideas? i'm lost cos it's working inside eclipse... so... (????)...

      Aldo