Archived

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

DefaultContext fail on Ice-3.0.0 ?

Hello,
I upgraded yesterday my project from Ice-2.1.2 to Ice-3.0.0.

Since this upgrade I haven't been able to use default context (transmission) or implicit context (transmission), which worked perfectly fine with Ice-2.1.2.

The context is transmitted correctly only, when I use an explicit context for each method call. In the other cases the reciever recives a null-Object for ctx.

My code (I'm using java):
java.util.Map ctx = new java.util.HashMap();
ctx.put("user", "phia");
// manager is a ICE-proxy to a service running on the server

default context:
communicator().setDefaultContext(ctx); 
manager.getAllSimulations(); 
// doesn't work any more, manager receives null for context

implicit context:
manager.ice_newContext(ctx);
manager.getAllSimulations(); 
// doesn't work any more, manager receives null for context


explizit context:
manager.getAllSimulations(ctx);
// this works, but I don't want to set the context for each Method,
// since it doesn't change! 

So my questions are:
* Has there been any changes between Ice-2.1.2 and Ice-3.0.0 in setting the default/implicit context?
* Am I somehow missing the point in using the context? I don't think so, since the same code has worked before!


I'm working with MacosX 10.3.9, java version 1.4.2_09.

Any help would be appreciated

Comments

  • benoit
    benoit Rennes, France
    Hi Stephanie,

    Yes, there was some changes regarding default contexes between Ice-2.1.2 and Ice-3.0.0 (see the Ice-3.0.0/CHANGES file for a complete list of the changes between these 2 versions). The setDefaultContext() method won't change anymore the context for existing proxies. It only affects the implicit context of new proxies.
    default context:
    communicator().setDefaultContext(ctx); 
    manager.getAllSimulations(); 
    // doesn't work any more, manager receives null for context
    

    Yes, this doesn't work anymore with Ice 3.0.0 if the manager proxy was created before the setDefaultContext call. You'll need to call setDefaultContext before creating the manager proxy if you want this to work.
    implicit context:
    manager.ice_newContext(ctx);
    manager.getAllSimulations(); 
    // doesn't work any more, manager receives null for context
    

    This isn't expected to work with Ice 2.1.2 or Ice 3.0.0. The ice_newContext() method doesn't modify the proxy, instead, it returns a new proxy so you should do the following to get it work:
     manager = manager.ice_newContext(ctx);
     manager.getAllSimulations();
    

    Let us know if this still doesn't work as expected!

    Cheers,
    Benoit.