Archived

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

problems with properties

Hello, I'm using Java with IceE,Glacier and IceStorm(a lot of things) and I´m trying to create an adapter with the following command:

Ice.ObjectAdapter adapter =communicator.createObjectAdapter("Monitor.Subscriber");

and in a file called config I have this:

Monitor.Subscriber.Router=DemoGlacier2/router:tcp -p 10000 -h 138.4.9.76

#
# This property is used to configure the endpoints of the monitor
# subscriber adapter.
#

Monitor.Subscriber.Endpoints=tcp

I think that the programa doest't undestand it because he doesn't know where is config file. In which place and what command I have to use to indicate that properties are in a file called config?

Thanks

Comments

  • benoit
    benoit Rennes, France
    Hi,

    There's several ways to specify the location of the configuration file, for example:
    • With the --Ice.Config command line option.
    • With the ICE_CONFIG environment variable.
    • With the third argument of main method of the Ice::Application class.
    See section 28.3 in the Ice manual for more information.

    Cheers,
    Benoit.
  • Problem with properties

    I have this code :
    Ice.Communicator communicator = null;


    Ice.Properties properties = Ice.Util.createProperties();

    properties.load("config");

    communicator = Ice.Util.initializeWithProperties(new String[0], properties);

    and I don't why it doesn`t run, it blocks

    Thanks
  • This problem is solved but is another new

    Hello, I have in one method(startApp) this:

    Ice.Properties properties = Ice.Util.createProperties();

    InputStream is = getClass().getResourceAsStream("config");
    properties.load(is);

    communicator = Ice.Util.initializeWithProperties(new String[0], properties);

    and in another method:

    Ice.Properties properties = communicator.getProperties();

    Glacier2.RouterPrx router =Glacier2.RouterPrxHelper.checkedCast(communicator.stringToProxy(properties.getProperty("Ice.Default.Router")));

    and an Exception is thrown:

    Ice::ConnectionLostException

    why this happens??

    Thanks
  • benoit
    benoit Rennes, France
    Hi,

    The ConnectionLostException seems to indicate that Glacier2 rejected the connection. If this exception comes from the RouterPrx::checkedCast() call, this is probably because you didn't properly configured the default router proxy.

    Could you post the configuration of your Glacier2 router and client? You should make sure that the Ice.Default.Router property matches the Glacier2 configuration.

    It should be something like:

    Ice.Default.Router=<instance name>/router:<glacier2 client endpoints>

    where <instance name> is the value of the Glacier2.InstanceName property and <glacier2 client endpoints> is the value of the Glacier2.Client.Endpoints property.

    Cheers,
    Benoit.
  • I think problem is the communicator

    Hello I have made proofs and these are the resultas:

    1 If you initalize communicator with:
    communicator=Ice.Util.initialize(new String[0]);
    and in the other method I put:
    Glacier2.RouterPrx router =Glacier2.RouterPrxHelper.checkedCast(communicator.stringToProxy(DemoGlacier2/router:tcp -p 10000 -h 138.4.9.76));

    it works fine

    2. If you intialize communicator with:
    Ice.Properties properties = Ice.Util.createProperties();

    InputStream is = getClass().getResourceAsStream("config");
    properties.load(is);

    communicator = Ice.Util.initializeWithProperties(new String[0], properties);
    and in the other method I put:
    Glacier2.RouterPrx router =Glacier2.RouterPrxHelper.checkedCast(communicator.stringToProxy(DemoGlacier2/router:tcp -p 10000 -h 138.4.9.76));

    it doesn't work and Ice::ConnectionLostException is thrown

    3.If you intialize communicator with:
    Ice.Properties properties = Ice.Util.createProperties();

    InputStream is = getClass().getResourceAsStream("config");
    properties.load(is);

    communicator = Ice.Util.initializeWithProperties(new String[0], properties);
    and in the other method I put:
    Glacier2.RouterPrx router =Glacier2.RouterPrxHelper.checkedCast(communicator.stringToProxy(properties.getProperty("Ice.Default.Router")));

    it doesn't work and Ice::ConnectionLostException is thrown

    what is the problem??

    A lot of thanks
  • marc
    marc Florida
    Perhaps you can provide a small, but complete, self-contained example. This will make it a lot easier to find out what's going on. Also, you could have a look at demo/Glacier2/callback, and try to find out how this demo differs from your application.