Search code examples
javatcpice

Caused by: java.net.ConnectException: Connection refused: no further information


When I run this programm it show this mistake. Dose it because i donot run the service? How to writ config files for the following code?

com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy("IceStorm/TopicManager:tcp -p 10000");

com.zeroc.IceStorm.TopicManagerPrx topicManager = com.zeroc.IceStorm.TopicManagerPrx.checkedCast(obj);

Solution

  • You need to run the IceStorm service to be able to connect to it, IceStorm/TopicManager is an object hosted by IceStorm service.

    if you want to define the topic manager using a property you should use communicator.propertyToProxy instead of communicator.stringToProxy and define the proxy in the configuration file used to initialize the configuration.

    com.zeroc.Ice.Communicator communicator = com.zeroc.Ice.Util.initialize(args, "config.sub", extraArgs);
    
    com.zeroc.IceStorm.TopicManagerPrx manager = com.zeroc.IceStorm.TopicManagerPrx.uncheckedCast(
                communicator.propertyToProxy("TopicManager.Proxy"));
    

    You should check IceStorm clock demo.