4 Replies Latest reply on Dec 23, 2003 1:49 PM by rhino

    Classpath issue with Client app

    rhino

      Greetings all:

      I put together the classic little HelloWorld stateful session bean with a simple client class that invokes setGreeting and getGreeting methods on the bean. To test it out, I put the client class (called TestHello.class) in a directory called "test" along with the jar file containing my session bean (MyBean.jar) and the jboss client jar (jbossall-client.jar).

      Now, on my Linux box everything works fine when I go to the command line and invoke:

      >java -classpath /test/jbossall-client.jar:/test/MyBean.jar:. TestHello

      The problem is that on my Windows XP box, the above does not work. Instead, I get the following error message:

      Exception in thread "main" java.lang.NoClassDefFoundError: TestHello

      Following is what I have in my jndi.properties file on the Windows XP box:

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url=jnp://192.168.1.102:1099/
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

      Following is what I have in my jndi.properties file on the Linux box:

      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

      Anyone have any ideas on how to get this Client to work on the Windows box??? This is starting to make me crazier than usual.

      Thanks.

      R

        • 1. Re: Classpath issue with Client app

          /etc/hosts

          See the FAQ forum

          Regards,
          Adrian

          • 2. Re: Classpath issue with Client app
            rhino

            Thanks Adrian.

            Fooling around with the /etc/hosts file on my Linux box does not solve the problem. I still get the same result/error message when I try to run the client on my windows box. For reference, here is what I have tried with respect to the IP reference on my Linux box.

            First I added the following line to the /etc/hosts file and then rebooted:

            192.168.1.102 localhost.localdomain localhost

            I also ran nmap -sS 192.168.1.102 1099 to verify I had an open port on 1099.

            Next I also tried starting Jboss with ./run.sh -Djava.rmi.server.hostname=192.168.1.102

            Third, I also tried configuring my Local Lan Router to forward all port 1099 requests it receives to port 1099 on 192.168.1.102

            Unfortunately, none of the above solved the problem. I know that the two machines can talk to each other as the Windows box can access webpages off of the Linux box when it is running Apache webserver and when I point the browser to http://192.168.1.102/some.htm

            Because of the above, I am more convinced the error is due to some persnickety problem with the way I am specifying the CLASSPATH when I try to run the Client -- TestHello.class

            Also for reference I am using JBoss 3.2 on RH 7.2.

            R

            • 3. Re: Classpath issue with Client app
              rhino

              Ok, I figured it out. The problem was in how I was specifying the classpath on the command line. Assuming all of the jars needed to run the client app: TestHello.class are located under /test

              Under Linux the following works:

              test> java -classpath /test/jbossall-client.jar: /test/MyBeans.jar:. TestHello

              Under Windows the following works:

              test> java -classpath C:\test\jbossall-client.jar;C:\test\MyBeans.jar;. TestHello

              R

              • 4. Re: Classpath issue with Client app
                rhino

                Quick followup.

                After working out the CLASSPATH issue above, I tested the IP address configuration in the /etc/hosts file on my Linux box and found that one must (at least on RH 7.2) put the following line in /etc/hosts

                (an IPaddress)+ localhost.localdomain localhost

                for example, in my case this is:

                192.168.1.102 localhost.localdomain localhost

                ALSO I found that in addition to the above I must start Jboss with the following:

                ./run.sh -Djava.rmi.server.hostname=192.168.1.102

                After doing all of the above, my TestHello client on the Windows box can access my HelloWorld session bean runing under the Jboss server on the Linux box.

                Hope this little bit of info helps others.

                R