Results 1 to 7 of 7

Thread: problems with properties

  1. #1
    cesartovic's Avatar
    cesartovic is offline Registered User
    Join Date
    Feb 2006
    Posts
    50

    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.Subscri ber");

    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
    Name: César Rodríguez Maurelo
    Project:working with TC65 that supports j2ME aplicattions and I will use Ice to comunicate with a server.The project is a consorcium betwen "Universidad Politecnica de Madrid" and "Recreativos Franco".
    url: http://www.die.upm.es/
    We are trying to improve the technologie of some game machines and one important aspect is communications.The project haven´t got name

  2. #2
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    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.

  3. #3
    cesartovic's Avatar
    cesartovic is offline Registered User
    Join Date
    Feb 2006
    Posts
    50

    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
    Name: César Rodríguez Maurelo
    Project:working with TC65 that supports j2ME aplicattions and I will use Ice to comunicate with a server.The project is a consorcium betwen "Universidad Politecnica de Madrid" and "Recreativos Franco".
    url: http://www.die.upm.es/
    We are trying to improve the technologie of some game machines and one important aspect is communications.The project haven´t got name

  4. #4
    cesartovic's Avatar
    cesartovic is offline Registered User
    Join Date
    Feb 2006
    Posts
    50

    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
    Name: César Rodríguez Maurelo
    Project:working with TC65 that supports j2ME aplicattions and I will use Ice to comunicate with a server.The project is a consorcium betwen "Universidad Politecnica de Madrid" and "Recreativos Franco".
    url: http://www.die.upm.es/
    We are trying to improve the technologie of some game machines and one important aspect is communications.The project haven´t got name

  5. #5
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    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.

  6. #6
    cesartovic's Avatar
    cesartovic is offline Registered User
    Join Date
    Feb 2006
    Posts
    50

    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
    Name: César Rodríguez Maurelo
    Project:working with TC65 that supports j2ME aplicattions and I will use Ice to comunicate with a server.The project is a consorcium betwen "Universidad Politecnica de Madrid" and "Recreativos Franco".
    url: http://www.die.upm.es/
    We are trying to improve the technologie of some game machines and one important aspect is communications.The project haven´t got name

  7. #7
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Ice::Properties save
    By ctennis in forum Comments
    Replies: 0
    Last Post: 03-07-2007, 01:12 PM
  2. config file properties
    By Greenhippo in forum Help Center
    Replies: 3
    Last Post: 01-16-2007, 03:07 AM
  3. Using Properties Programmatically
    By Oleh Babyak in forum Help Center
    Replies: 1
    Last Post: 11-22-2006, 11:33 AM
  4. How to load empty properties?
    By n2503v in forum Help Center
    Replies: 1
    Last Post: 07-20-2006, 08:30 AM
  5. Properties for the callback demo
    By catalin in forum Help Center
    Replies: 1
    Last Post: 02-16-2004, 09:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •