Archived

This forum has been archived. Please start a new discussion on GitHub.

Simple IceGrid Java Demo for a total Newbie

I'm a total newbie at this. I hope someone can help me. This could be more of a classpath and package issue. I'm not familiar with command line compilation, I usually use an IDE so any help would be appreciated.

I am trying to run the Simple IceGrid Java Demo in the demoj\IceGrid\simple folder.

However when I try to run "java Client", it says "Exception in thread "main" java.lang.NoClassDefFoundError: Client"

And so I open the Client.java file and find that it needs the Demo package.

I then do a "slice2java Hello.ice" and I get the generated Demo folder.

Next: javac -classpath "c:\Ice-3.1.1\lib\Ice.jar" -d . *.java

And I get errors like this:
Client.java:10: package Demo does not exist
import Demo.*;
^
HelloI.java:10: package Demo does not exist
import Demo.*;
^
HelloI.java:12: cannot find symbol
symbol: class _HelloDisp
public class HelloI extends _HelloDisp
^


What do I do next?

Comments

  • I used Eclipse IDE to import the project and everything's compiled fine, but when I run the Client, I get this:

    Client: Ice.NoEndpointException
    proxy = "hello -t"
    Ice.NoEndpointException
    proxy = "hello -t"
    at IceInternal.RoutableReference.createConnection(RoutableReference.java:364)
    at IceInternal.IndirectReference.getConnection(IndirectReference.java:175)
    at Ice._ObjectDelM.setup(_ObjectDelM.java:258)
    at Ice.ObjectPrxHelperBase.__getDelegate(ObjectPrxHelperBase.java:905)
    at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:73)
    at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:61)
    at Demo.HelloPrxHelper.checkedCast(HelloPrxHelper.java:88)
    at Client.run(Client.java:36)
    at Ice.Application.main(Application.java:114)
    at Ice.Application.main(Application.java:57)
    at Client.main(Client.java:106)


    And this in the window where I started up the IceGrid service:
    [ icegridnode: Activator: activating server `SimpleServer' ]
    Exception in thread "main" java.lang.NoClassDefFoundError: Ice/Application
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    [ icegridnode: Activator: detected termination of server `SimpleServer'
    exit code = 1 ]
    [ icegridnode: Activator: activating server `SimpleServer' ]
    Exception in thread "main" java.lang.NoClassDefFoundError: Ice/Application
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    [ icegridnode: Activator: detected termination of server `SimpleServer'
    exit code = 1 ]
    [ icegridnode: Activator: activating server `SimpleServer' ]
    Exception in thread "main" java.lang.NoClassDefFoundError: Ice/Application
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    [ icegridnode: Activator: detected termination of server `SimpleServer'
    exit code = 1 ]
    [ icegridnode: Activator: activating server `SimpleServer' ]
    Exception in thread "main" java.lang.NoClassDefFoundError: Ice/Application
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    [ icegridnode: Activator: detected termination of server `SimpleServer'
    exit code = 1 ]


    Very confused. I'd also still like some help with the command line compilation as in the above post. Thanks in advance!
  • benoit
    benoit Rennes, France
    Hi,

    Could you please set your signature as detailed in this [thread=1687]thread[/thread]?

    You need to run the "ant" command to compile the demos (see the instructions from the README.txt file for information on how to setup your environment, compile and run the Java demos).

    Also, you need to set the CLASSPATH environment variable in the window where you start the IceGrid node service otherwise the Java server started by the node won't be able to find the classes.

    Cheers,
    Benoit.
  • Are you sure that's the right thread?
    yxt wrote:
    hi,i need help.
    how can i get user's real ip.
    how to know a user connect/disconnect to server.

    thanks.

    I'm not sure what you mean by signature.

    I'll run the ant stuff tomorrow and get back to you.

    Many thanks!
  • benoit
    benoit Rennes, France
    Oops sorry, wrong thread :). I meant [thread=1697]this thread[/thread].

    Cheers,
    Benoit.
  • Signature done :)
  • Same problem I meet,too.
  • .. Client: Ice.NoEndpointException..

    Hello everybody, it´s the first time that I post something here, i´ve been experienced some dificulties having Icegrid running...

    I´ve done everything you have said in the posts, tryed to change the CLASSPATH and PATH.. nothing seems to work.

    I get allways the same error at the server with main not found. and at Client when I execute it from Ecplipse(that I used to import the files).
    Client: Ice.NoEndpointException
    proxy = "Hello-1 -t @ Server1-1.Hello"


    When I try to execute Client at the prompt the same error as Server occurs...

    Exception in thread "main" java.lang.NoClassDefFoundError: Client
    Caused by: java.lang.ClassNotFoundException: Client
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Meth
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Sour
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: Client. Program will exit.

    It´s been very annoying ,I just can´t quite understand what I have done wrong...

    Can anyone help me?or make some king of tutorial on video????

    Thanks in advance.
  • Hello again, I forgot to tell I´m running on XP
  • matthew
    matthew NL, Canada
    I definitely do not recommend using eclipse to compile our demos. You should use ant, which is already setup correctly to build everything. You are trying to run the demo/IceGrid/simple demo, and you have correct built the application, and setup the CLASSPATH correctly?
  • I think so...

    Can you post me how the classpath must be? so I can compare with mine?

    I have tried to build my own aplication similarly to the demo.

    I have never used ant to build java files...
  • Those are the contents of my environment variables
  • matthew
    matthew NL, Canada
    We'll post a screencast a little later on today where I show you how to build and run this demo from scratch.
  • Thanks Mathew.

    I have already compile the demo successfuly, now I can´t run the client but I think that is a problem on the environment with Java.

    I´ll apreciate the screencast thanks again.
  • matthew
    matthew NL, Canada
    Hopefully the screencast will clear things up for you. After you watch it, if you still cannot figure out what you are doing wrong, then please provide some more information and I'll do my best to help.
  • mes
    mes California
    Matthew's screencast is now available on our screencasts page.
  • I guys thanks for the efford I finaly did it, I can now run the demo succesfully.

    Now I´m gonna try to build an application with more funcionalities and work for my thesis, thanks a lot for your help.:)