2 Replies Latest reply on Nov 26, 2003 1:27 PM by b_boyle18

    Problem: org.jnp.interfaces.NamingContextFactory

    b_boyle18

      Hi!
      I've setup a CMP entity bean using Hypersonic as my database. My EJB deploys fine and the datasource is configured correctly. I am trying to run a test client to lookup my entity EJB and read all my Customers from the database. When I run the test client I get this exception:
      javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory. Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory

      What I want to know is whether it is possible to run a client independently or does it have to be deployed to JBoss. I also heard something about jbossall-client.jar. It said something about being in your classpath. Is this my System classpath as in my environment variables or a different one.
      A snippet of my client code is below. The bold part is where my error is thrown. Hope someone can help!
      Thanks,
      Brian

      try
      {
      Properties jndiProps = new Properties();
      jndiProps.setProperty(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      jndiProps.setProperty(Context.URL_PKG_PREFIXES,
      "org.jboss.naming:org.jnp.interface");
      jndiProps.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
      Object reference = (new InitialContext(jndiProps)).lookup
      ("MyCustomerBean");
      MyCustomerLocalHome myCustomerLocalHome = (MyCustomerLocalHome)PortableRemoteObject.narrow(reference,
      MyCustomerLocalHome.class);
      customer = myCustomerLocalHome.findAll();
      System.out.println( customer );