Home Help Center

problem with addwithuuid, got objectnotexistexception

ukungukung Member Ukung Noe AingOrganization: ?NOEAING, INCProject: Mobile Money Services
My problem is creates proxy with addwithuuid, I got objectnotexistexception but when I use add(myservant, iceidentity) it works.

What I want to do just obtaining proxy by invoking operations.
At server side code is something like this:
public override APrx getA(string name, Ice.Current current__)
{
            A a = new A(name);
            Ice.ObjectPrx objPrx = current__.adapter.addWithUUID(a);
            //Ice.ObjectPrx objPrx = current__.adapter.add(a, new Ice.Identity("Module.A", ""));
            APrx aPrx = APrxHelper.uncheckedCast(objPrx);
            return aPrx;
}

At client side when invoke operation on object servant a (eg: a.getName()),
it works well when I use adapter's add method but i got objectnotexistexception when I use addwithUUID.

"Module.A" is string qualified name of my servant, I'm using C#.
My service deploy on icebox server node, and using Glacier2

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Can you post the code from your client where you obtain the proxy on the A object and where you invoke the getName method?

    Cheers,
    Benoit.
  • ukungukung Member Ukung Noe AingOrganization: ?NOEAING, INCProject: Mobile Money Services
    benoit wrote: »
    Hi,

    Can you post the code from your client where you obtain the proxy on the A object and where you invoke the getName method?

    Cheers,
    Benoit.

    Thank you for your replay,
    Here I post my example code:

    slice file
    module noeaing {
    	interface A {
    		string getName();
    	};
    
    	interface Example {
    		A* getA(string name);
    	};
    };
    

    server side
    namespace Module
    {
        public class A : ADisp_
        {
            private string _name;
    
            public A(string name)
            {
                this._name = name;
            }
            public override string getName(Ice.Current current__)
            {
                return this._name;
            }
        }
    
        public class ExampleService : ExampleDisp_
        {
            public override APrx getA(string name, Ice.Current current__)
            {
                A a = new A(name);
                Ice.ObjectPrx objPrx = current__.adapter.addWithUUID(a);
                //Ice.ObjectPrx objPrx = current__.adapter.add(a, new Ice.Identity("Module.A", ""));
                APrx aPrx = APrxHelper.uncheckedCast(objPrx);
                return aPrx;
            }
        }
    }
    

    client side
    ExamplePrx exPrx = ExamplePrxHelper.checkedCast(communicator.propertyToProxy("ExampleService"));
    
    APrx aPrx = exPrx.getA("My Name");
    // test method invoke on proxy APrx
    Console.Write(aPrx.getName());
    
    
    

    config at client
    ExampleService=Module.ExampleService
    

    What I do on client is obtain proxy by stringified first (ExamplePrx proxy) then on that proxy invoke operation to get APrx and than using APrx I call my method getName().
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    It's not clear to me why you get the Ice.ObjectNotExistException. Can you tell us a bit more about the deployment of your server? Are you using IceGrid? In the client, can you print out to the console the proxy obtained from the getA() method in both scenarios?

    Cheers,
    Benoit.
  • ukungukung Member Ukung Noe AingOrganization: ?NOEAING, INCProject: Mobile Money Services
    benoit wrote: »
    It's not clear to me why you get the Ice.ObjectNotExistException. Can you tell us a bit more about the deployment of your server? Are you using IceGrid? In the client, can you print out to the console the proxy obtained from the getA() method in both scenarios?

    Cheers,
    Benoit.

    Yes I use IceGrid for deployment my service.
    here is the output in the client for code snippet:
    ExamplePrx exPrx = ExamplePrxHelper.checkedCast(communicator.propertyToProxy("ExampleService"));
    
    APrx aPrx = exPrx.getA("My Name");
    
    Console.WriteLine("ice_getAdapterId : " + aPrx.ice_getAdapterId());
    Console.WriteLine("ice_getIdentity : " + aPrx.ice_getIdentity().name);
    Console.WriteLine("Hello : " + aPrx.getName());
    

    output from scenario 1 using add method:
    ice_getAdapterId : Noeaing.ReplicaGroup
    ice_getIdentity : Module.A
    Hello : My Name

    output from scenario 2 using addwithuuid method:
    ice_getAdapterId : Noeaing.ReplicaGroup
    ice_getIdentity : <uuid value>
    Ice.ObjectNotExistException is thrown here
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi

    In the server, can you try creating the proxy with createIndirectProxy(identity) and see if it fixes the problem?

    For example:
    public override APrx getA(string name, Ice.Current current__)
    {
          A a = new A(name);
          Ice.ObjectPrx objPrx = current__.adapter.addWithUUID(a);
          APrx aPrx = APrxHelper.uncheckedCast(current__.adapter.createIndirectProxy(objPrx.ice_getIdentity());
          return aPrx;
    }
    

    If it works, this indicates that you have several replicas deployed and your client was invoking the getName method on the wrong replica. The proxy returned by addWithUUID contains the replica group ID so potentially the call can go to any of the replicas. However, only one replica has an instance of the Ice object so if it calls on the wrong replica the Ice.ObjectNotExistException is expected.

    The proxy created with createIndirectProxy doesn't contain the replica group ID, it contains the adapter id instead, so it identifies the specific object adapter where the Ice object was added.

    Cheers,
    Benoit.
  • ukungukung Member Ukung Noe AingOrganization: ?NOEAING, INCProject: Mobile Money Services
    benoit wrote: »
    Hi

    In the server, can you try creating the proxy with createIndirectProxy(identity) and see if it fixes the problem?

    Cheers,
    Benoit.

    I've done trying creating the proxy with createIndirectProxy(identity) but it still raise Ice.ObjectNotExistException.

    client output:
    ice_getAdapterId : MyNode.Noeaing.Adapter
    ice_getIdentity : 4a4234ce-0b42-4c46-8285-b84d4c4352de
    Ice.ObjectNotExistException
        id.name = "4a4234ce-0b42-4c46-8285-b84d4c4352de"
        id.category = ""
        facet = ""
        operation = "getName"
    
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    I don't understand why you get this ObjectNotExistException here. Could you send us a small test case? You can try to modify the IceGrid demo to reproduce the problem for example.

    Cheers,
    Benoit.
  • ukungukung Member Ukung Noe AingOrganization: ?NOEAING, INCProject: Mobile Money Services
    benoit wrote: »
    Hi,

    I don't understand why you get this ObjectNotExistException here. Could you send us a small test case? You can try to modify the IceGrid demo to reproduce the problem for example.

    Cheers,
    Benoit.

    Ok, thank for your guidance. I'll doing as you suggested, asap I update if there're any progress about this.
Sign In or Register to comment.