Results 1 to 3 of 3

Thread: Unable to register object in icepack registry

  1. #1
    annekat is offline Registered User
    Name: Christophe Avare
    Organization: Thales Research & Technology
    Project: none at the moment
    Join Date
    Jul 2004
    Location
    Paris
    Posts
    40

    Unhappy Unable to register object in icepack registry

    Hello,

    I am trying to automatically register some objects in the registry after the adapter being created with the following code (object names are given in the command line):

    Code:
    public class EchoAgent extends Application {
    	public int run(String[] args) {
    		AdminPrx admin = AdminPrxHelper.checkedCast(communicator().stringToProxy(
    			"IcePack/Admin"));
    		ObjectAdapter adapter = communicator().createObjectAdapter("LocalNode");
    		adapter.activate();
    		for (int i = 0; i < args.length; i++) {
    			Identity id = new Identity();
    			//id.category = "Agents";
    			id.name = args[i];
    			ObjectPrx agent = adapter.add(new EchoAgentServant(args[i]), id);
    			try {
    				admin.removeObject(agent);
    			} catch (ObjectNotExistException e1) {
    				// e1.printStackTrace();
    			}
    			try {
    				admin.addObject(agent);
    				System.out.println(Util.identityToString(agent.ice_getIdentity())
    					+ " registered");
    			} catch (ObjectExistsException e) {
    				System.out.println(Util.identityToString(agent.ice_getIdentity())
    					+ " already registered");
    				//e.printStackTrace();
    			} catch (DeploymentException e) {
    				e.printStackTrace();
    				communicator().shutdown();
    				return 1;
    			}
    		}
    		communicator().waitForShutdown();
    		return 0;
    	}
    
    	public static void main(String[] args) {
    		EchoAgent app = new EchoAgent();
    		System.exit(app.main("EchoAgent", args));
    	}
    }
    The adapter is correctly registered, but the admin.addObject() call always fails with a DeployementException:

    Code:
    IcePack.DeploymentException
        reason = "Couldn't invoke on the object to get its interface."
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    	at java.lang.Class.newInstance0(Class.java:350)
    	at java.lang.Class.newInstance(Class.java:303)
    	at IceInternal.BasicStream$DynamicUserExceptionFactory.createAndThrow(BasicStream.java:1780)
    	at IceInternal.BasicStream.throwException(BasicStream.java:1413)
    	at IcePack._AdminDelM.addObject(_AdminDelM.java:91)
    	at IcePack.AdminPrxHelper.addObject(AdminPrxHelper.java:70)
    	at IcePack.AdminPrxHelper.addObject(AdminPrxHelper.java:54)
    	at EchoAgent.run(EchoAgent.java:40)
    	at Ice.Application.main(Application.java:66)
    	at Ice.Application.main(Application.java:31)
    	at EchoAgent.main(EchoAgent.java:59)

    (icepack config file attached)

    Not sure of this, but this code used to work with Ice 1.5.1 (still investigating).

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi,

    In response to a call to addObject, the IcePack registry attempts to call ice_id on the given proxy. If an exception occurs, the registry returns DeploymentException.

    I suggest setting Ice.Trace.Network=3 in the IcePack registry to determine the addressing information the registry is using in its attempt to contact the object. If the object and the registry are on different hosts, perhaps the object's endpoints are not configured correctly.

    Take care,
    - Mark

  3. #3
    annekat is offline Registered User
    Name: Christophe Avare
    Organization: Thales Research & Technology
    Project: none at the moment
    Join Date
    Jul 2004
    Location
    Paris
    Posts
    40

    Exclamation Problem solved but strong warning!

    It appears that in the config file we used 'LocalNode' as the adapter id.
    This is a very bad idea!
    This name apparently collapses with some internal id, for example if you issue 'adapter endpoints LocalNode' you get the error:
    Code:
    error: IcePack::NodeUnreachableException
    which means that the id was identified as something else (you certainly know why).

    More, the config file has been mistakenly modified so that the 'LocalNode.Endpoints' property was actually 'LocalNode.Endpoint'.

    It also appears that not defining a xxx.Endpoints leads to a DeploymentException.

    I don't know if a missing endpoints property can be equivalent to 'default', but if this is not the case, then an error/warning must be issued if such a property is missing.

    To conclude:

    You got a DeploymentException if:
    - You set 'LocalNode' to an adapter id
    - You don't set its Endpoints property.

    Hope this help.
    --
    Christophe

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. icepack registry redundancy
    By gminorcoles in forum Help Center
    Replies: 3
    Last Post: 07-12-2005, 04:27 AM
  2. how to listen on 0.0.0.0 and register to registry?
    By soloman817 in forum Help Center
    Replies: 6
    Last Post: 05-20-2005, 07:10 AM
  3. Replies: 9
    Last Post: 11-15-2004, 07:30 AM
  4. Replies: 0
    Last Post: 10-21-2004, 05:12 PM
  5. Problem with IcePack.Registry
    By boxban in forum Help Center
    Replies: 0
    Last Post: 10-15-2004, 05:31 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
  •