Home Bug Reports

error running Java server on XP

I am trying to run the Hello Server in Java. Initially the code would not compile because I didnot have the ice.jar in the classpath. ( I had the directory in the classpath as mentioned in the documentation - 3.4 - Writing an Ice application with Java and it doesn't work). Once I added the jar, I went past compilation and ended up with error below.

F:\iceproject>set ICEJ_HOME=F:\IceJ-1.0.0

F:\iceproject>javac -d classes -classpath classes;F:/IceJ-1.0.0/lib/ice.jar -sou
rce 1.4 Server.java HelloI.java generated/*.java

F:\iceproject>javac -d classes -classpath classes;F:/IceJ-1.0.0/lib/ice.jar -sou
rce 1.4 Client.java HelloI.java generated/*.java

F:\iceproject>java -classpath classes;F:/IceJ-1.0.0/lib/ice.jar;. Server
Ice.SyscallException
error = 0
at Ice.PropertiesI.load(PropertiesI.java:171)
at Server.main(Server.java:37)
Caused by: java.io.FileNotFoundException: config (The system cannot find the fil
e specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:103)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at java.io.FileReader.<init>(FileReader.java:39)
at Ice.PropertiesI.load(PropertiesI.java:165)
... 1 more

F:\iceproject>java -version
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Re: error running Java server on XP
    Originally posted by dipakyadav

    F:\iceproject>java -classpath classes;F:/IceJ-1.0.0/lib/ice.jar;. Server
    Ice.SyscallException
    error = 0
    at Ice.PropertiesI.load(PropertiesI.java:171)

    This means that the server cannot find the file "config", which contains the properties for the hello demo. "config" is in demo/Ice/hello, so if you start the server from within this directory, this file should be found.
    Originally posted by dipakyadav

    F:\iceproject>java -version
    java version "1.4.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
    Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

    I don't think this is related to the problem, but you should definitely upgrade to version 1.4.1. The NIO implementation in 1.4.0 was badly broken.
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    Hi,
    Initially the code would not compile because I didnot have the ice.jar in the classpath. ( I had the directory in the classpath as mentioned in the documentation - 3.4 - Writing an Ice application with Java and it doesn't work).

    .jar files have to be added individually to your CLASSPATH. After re-reading the documentation I think it could be a little more precise.
    F:\iceproject>java -classpath classes;F:/IceJ-1.0.0/lib/ice.jar;. Server
    Ice.SyscallException
    error = 0
    at Ice.PropertiesI.load(PropertiesI.java:171)
    at Server.main(Server.java:37)

    The hello world demo that comes bundled with the icej distribution expects to be run from the demo/Ice/hello directory since it loads a confiiguration file (config) from that directory - hence the error.

    Regards, Matthew
  • Mark/Mathew,

    I don't see a config file under demo/Ice/hello. There is a config directory under ICEJ_ROOT.
    I downloaded the following file IceJ-1.0.0.zip. Can you confirm if this zip file includes the config file under demo/Ice/hello.

    Mark,
    Thanks for the advice about upgrading Java. I will try to find time to do that.

    thanks,
    Dipak
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    It's definitely in the .zip file:

    [...]
    6641 02-04-03 17:32 IceJ-1.0.0/demo/Ice/hello/Client.java
    549 02-04-03 17:32 IceJ-1.0.0/demo/Ice/hello/Hello.ice
    860 02-04-03 17:32 IceJ-1.0.0/demo/Ice/hello/HelloI.java
    1638 02-04-03 17:32 IceJ-1.0.0/demo/Ice/hello/Server.java
    1630 02-04-03 17:32 IceJ-1.0.0/demo/Ice/hello/build.xml
    1117 02-06-03 18:56 IceJ-1.0.0/demo/Ice/hello/config <--- here it is
    [...]
  • Somehow I missed this file when I unzipped the zip file. I started the server and then ran the client and ended up with this error.

    F:\IceJ-1.0.0\demo\Ice\hello>java -classpath classes;F:\IceJ-1.0.0\lib\ice.jar C
    lient
    usage:
    t: send greeting as twoway
    o: send greeting as oneway
    O: send greeting as batch oneway
    d: send greeting as datagram
    D: send greeting as batch datagram
    f: flush all batch requests
    T: set a timeout
    S: switch secure mode on/off
    s: shutdown server
    x: exit
    ?: help

    ==> t
    Ice.ConnectFailedException
    error = 0
    at IceInternal.Network.doConnect(Network.java:205)
    at IceInternal.TcpConnector.connect(TcpConnector.java:30)
    at IceInternal.OutgoingConnectionFactory.create(OutgoingConnectionFactor
    y.java:254)
    at Ice._ObjectDelM.setup(_ObjectDelM.java:322)
    at Ice.ObjectPrxHelper.__getDelegate(ObjectPrxHelper.java:697)
    at HelloPrxHelper.sayHello(Unknown Source)
    at HelloPrxHelper.sayHello(Unknown Source)
    at Client.run(Unknown Source)
    at Client.main(Unknown Source)
    Caused by: java.net.ConnectException: Connection refused: no further information

    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:334
    )
    at IceInternal.Network.doConnect(Network.java:177)
    ... 8 more
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Most likely this is because of the broken NIO in the JDK version you're using. Please upgrade to JDK1.4.1 and try again.
  • I have downloaded java 1.4.1 and the sample seems to work for TCP. However if i use the option 'd' on the client it throws the following exception. Do I need to change something so that the server accepts UDP connections? I am attaching the trace of my server and client sessions.

    warning: connection exception:
    Ice.SocketException
    error = 0
    at IceInternal.UdpTransceiver.read(UdpTransceiver.java:150)
    at IceInternal.Connection.read(Connection.java:676)
    at IceInternal.ThreadPool.read(ThreadPool.java:654)
    at IceInternal.ThreadPool.run(ThreadPool.java:604)
    at IceInternal.ThreadPool.access$100(ThreadPool.java:17)
    at IceInternal.ThreadPool$EventHandlerThread.run(ThreadPool.java:886)
    Caused by: java.net.PortUnreachableException
    at sun.nio.ch.DatagramChannelImpl.receive0(Native Method)
    at sun.nio.ch.DatagramChannelImpl.receiveIntoNativeBuffer(DatagramChann
    lImpl.java:185)
    at sun.nio.ch.DatagramChannelImpl.receive(DatagramChannelImpl.java:174)
    at sun.nio.ch.DatagramChannelImpl.receive(DatagramChannelImpl.java:122)
    at IceInternal.UdpTransceiver.read(UdpTransceiver.java:141)
    ... 5 more
    Caused by:

    java.net.PortUnreachableException
    at sun.nio.ch.DatagramChannelImpl.receive0(Native Method)
    at sun.nio.ch.DatagramChannelImpl.receiveIntoNativeBuffer(DatagramChann
    lImpl.java:185)
    at sun.nio.ch.DatagramChannelImpl.receive(DatagramChannelImpl.java:174)
    at sun.nio.ch.DatagramChannelImpl.receive(DatagramChannelImpl.java:122)
    at IceInternal.UdpTransceiver.read(UdpTransceiver.java:141)
    at IceInternal.Connection.read(Connection.java:676)
    at IceInternal.ThreadPool.read(ThreadPool.java:654)
    at IceInternal.ThreadPool.run(ThreadPool.java:604)
    at IceInternal.ThreadPool.access$100(ThreadPool.java:17)
    at IceInternal.ThreadPool$EventHandlerThread.run(ThreadPool.java:886)
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    I can reproduce this problem. Thanks for the bug report!
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Dipak,

    A fix for this problem will be included in the next release. If you would like a patch sooner, let me know.

    Thanks again,
    - Mark
Sign In or Register to comment.