5 Replies Latest reply on Aug 6, 2002 9:52 PM by mtran

    client fails to run on template project

    davidfreer

      Hi Jboss Developers,

      I have built and installed the JBOSS 3.0 template project and started JBOSS. However the client fails to run.

      I issue the run-cient.sh command and get the following
      exception:

      javax.naming.NoInitialContextException: Need to specifiy
      class name in environment or system property, or as an
      applet parameter, or in an application resource file:
      java.naming.factory.initial

      at javax.naming.spi.NamingManger.getInitialContext(NamingM638)
      at javax.naming.InitialContext.getDefaultInitCtx(initialConte
      at javax.naming.InitialContext.getURLorDefaultInitCtx(InitialContext.java.278)
      at javax.naming.InitialContext.lookup(InitialContext.java.345)
      at test.client.TestClient.main(TestClient.java:21)

      I am using suse linux version 7.0

      When I use the jsp page:
      http://localhost:8080/web-client
      it works fine.

      Any help much appreciated.

      David Freer.

        • 1. Re: client fails to run on template project
          sharkman

          Do you have an file named "jndi.properties" in the directory from which you start the client which contains these lines:

          java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
          java.naming.provider.url=localhost
          java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

          If not, make one.

          - Stefan

          • 2. Re: client fails to run on template project
            joelvogt

            Or something like:

            java.util.Hashtable props = new java.util.Hashtable();
            props.put(Context.INITIAL_CONTEXT_FACTORY,
            "org.jnp.interfaces.NamingContextFactory");
            props.put(Context.PROVIDER_URL, localhost);
            props.put("java.naming.rmi.security.manager", "yes");
            props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces
            ");

            Then,
            Context context = new InitialContext(props);

            If you don't want to/can't use a props file

            • 3. Re: client fails to run on template project
              alwyn

              Hi,

              What if it still fails with same error even though the file exists and have
              precisely the contents in your post?

              • 4. Re: client fails to run on template project
                knowuse

                Hoi,

                I think that there are some pieces missing, this worked for me.

                props.put(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
                props.put(InitialContext.PROVIDER_URL, "localhost");
                props.put("java.naming.rmi.security.manager", "yes");
                props.put(InitialContext.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");


                Doei Diego

                • 5. Re: client fails to run on template project
                  mtran

                  Hi,

                  I have the exact same problem...My template's JSP is under the webapp/test/jsp/index.jsp. And under webapp/test/WEB_INF/lib, my *.jar and &.war files are there. Under webapp/WEB_INF, i have the web.xml et jboss-web.xml. I've mounted those directories. But still, when acessing the index.jsp, i have this message :

                  javax.naming.NamingException: Cannot create resource instance

                  What could I possibly forgot to set up?

                  oh, btw, where should i copy the jndi.properties file?

                  Thx,
                  Meg