3 Replies Latest reply on Mar 11, 2003 4:06 PM by Olaf

    Problem with JNDI

    Taud Anas Newbie

      While installing JBoss I have problem in step:
      "Coding and compiling the test client" at page http://www.jboss.org/online-manual/HTML/ch01.html

      When I run the command:
      ant intro-interest-client

      I have this :

      ------------------------------------------------------
      Buildfile: build.xml

      validate-servlet:

      validate-jboss:

      fail_if_not_valid:

      init:
      [echo] Using JBoss directory=E:\jboss-3.0.4_tomcat-4.1.12
      [echo] Using base classpath=E:\jboss-3.0.4_tomcat-4.1.12\client\jboss-j2ee.jar;E:\jboss-3.0.4_tomcat-4.1.12\client\jaas.jar;E:\jboss-3.0.4_tomcat-4.1.12\client\jbosssx-client.jar;E:\jboss-3.0.4_tomcat-4.1.12\client\jboss-client.jar;E:\jboss-3.0.4_tomcat-4.1.12\client\jnp-client.jar;E:\jboss-3.0.4_tomcat-4.1.12\examples\COULD_NOT_FIND_SERVLET_JAR
      [echo] Using Source directory=E:\jboss-3.0.4_tomcat-4.1.12\examples
      [echo] Using Build directory=E:\jboss-3.0.4_tomcat-4.1.12\examples/build-examples

      intro-interest-client:

      compile:

      interest-client:
      [java] java.lang.NoClassDefFoundError: javax/net/SocketFactory
      [java] at org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingContextFactory.java:42)
      [java] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:665)
      [java] at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
      [java] at javax.naming.InitialContext.init(InitialContext.java:222)
      [java] at javax.naming.InitialContext.(InitialContext.java:178)
      [java] at org.jboss.docs.interest.InterestClient.main(InterestClient.java:27)
      [java] Exception in thread "main"

      BUILD SUCCESSFUL

      Total time: 3 seconds
      ----------------------------------------------------

      Instead of having

      ------------------------------------------------------
      ....

      interest-client:
      [echo] Using client classpath: /tmp/JBoss-2.2.2/client/ejb.jar:/tmp/JBoss-2.2.2/client/jaas.jar:/tmp/JBoss-2.2.2/client/jbosssx-client.jar:/tmp/JBoss-2.2.2/client/jboss-client.jar:/tmp/JBoss-2.2.2/client/jnp-client.jar:/tmp/tomcat/lib/servlet.jar:/tmp/examples/build-examples/interest/classes:/tmp/examples/resources
      [java] Got context
      [java] Got reference
      [java] Interest on 1000 units, at 10% per period, compounded over 2 periods is:
      [java] 210.00000000000023

      BUILD SUCCESSFUL

      ---------------------------------------------------------

      It seams to be a problem with using client classpath, but I do not now how to solve it.

      Thank U for Your help.

        • 1. Re: Problem with JNDI
          zaki Newbie

          Hi,
          I'am a newbie in Jboss.
          I have the same problem, when i try to this.
          do you cam to any Solutions.
          thanks.

          • 2. Re: Problem with JNDI
            Olaf Newbie

            Hi,
            I had a similar problem.

            I included the following jndi.properties file in my classpath:

            # Do NOT uncomment this line as it causes in VM calls to go over
            # RMI!
            java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
            java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
            java.naming.provider.url=localhost:1099

            and I am starting my program with the following command:

            java -cp ".:../jboss/client/jnp-client.jar:../jboss/client/jnet.jar:../jboss/client\
            /log4j.jar:../jboss/client/jbossall-client.jar" helloworld.HelloWorldClient

            Thats how I solved the naming problems.

            • 3. Re: Problem with JNDI
              Olaf Newbie

              Hi,
              I had a similar problem.

              I included the following jndi.properties file in my classpath:

              # Do NOT uncomment this line as it causes in VM calls to go over
              # RMI!
              java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
              java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
              java.naming.provider.url=localhost:1099

              and I am starting my program with the following command:

              java -cp ".:../jboss/client/jnp-client.jar:../jboss/client/jnet.jar:../jboss/client\
              /log4j.jar:../jboss/client/jbossall-client.jar" helloworld.HelloWorldClient

              Thats how I solved the naming problems.