2 Replies Latest reply on Oct 28, 2002 9:37 AM by Chuck Siebsen

    Applet accessing EJB problem

    Chuck Siebsen Newbie

      I have an applet attempting to access an EJB that's failing with an error of javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org/jnp/interfaces/NamingContextFactory
      I get the error on the new InitialContext() call in my applet shown below:

      Properties p = new Properties();
      p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      p.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      Context initial = new InitialContext(p);

      here's the entry in my JSP

      <jsp:plugin type="applet" code="View1_Applet.class" codebase="/cjs-client/applets"
      jreversion="1.2" width="100%" height="100%"
      iepluginurl = "http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0"
      nspluginurl = "http://java.sun.com/products/plugin/1.2/plugin-install.html"
      archive = "jbossall-client.jar, log4j.jar, jnp-client.jar, jnet.jar"
      Plugin tag OBJECT or EMBED not supported by browser.

      I've already determined that my applet, running in the browser can't find the necessary jar files listed in the archive tag above. I also get an error when I first access the web page with the applet on the order of:

      java.io.FileNotFoundException: http://localhost:8080/cjs-client/applets/jbossall-client.jar

      I get one of these for each jar file referenced in the archive attribute shown above.

      Incidentaly, I can access the EJB with no problems from the same web page with embedded java code right on the jsp itself, like this:

      try {
      Context lContext = new InitialContext();
      TestSessionHome lHome = (TestSessionHome) lContext.lookup(
      TestSession lSession = lHome.create();
      out.println( "" + lSession.getNewEntityId() );
      catch( Exception e ) {
      out.println( "Caugth exception: " + e.getMessage() );

      I'm thinking the solution is to set my classpath correctly, which I think I've done as shown below;


      This is the classpath on the machine where I'm running both my client and server.

      I've read the many similar problems listed in the JBoss forums, but can't seem to put my finger on what I'm missing.

      Any input you may have is greatly appreciated.