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

Unable to register object in icepack registry


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):
public class EchoAgent extends Application {
	public int run(String[] args) {
		AdminPrx admin = AdminPrxHelper.checkedCast(communicator().stringToProxy(
		ObjectAdapter adapter = communicator().createObjectAdapter("LocalNode");
		for (int i = 0; i < args.length; i++) {
			Identity id = new Identity();
			//id.category = "Agents"; = args[i];
			ObjectPrx agent = adapter.add(new EchoAgentServant(args[i]), id);
			try {
			} catch (ObjectNotExistException e1) {
				// e1.printStackTrace();
			try {
					+ " registered");
			} catch (ObjectExistsException e) {
					+ " already registered");
			} catch (DeploymentException e) {
				return 1;
		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:
    reason = "Couldn't invoke on the object to get its interface."
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
	at java.lang.reflect.Constructor.newInstance(
	at java.lang.Class.newInstance0(
	at java.lang.Class.newInstance(
	at IceInternal.BasicStream$DynamicUserExceptionFactory.createAndThrow(
	at IceInternal.BasicStream.throwException(
	at IcePack._AdminDelM.addObject(
	at IcePack.AdminPrxHelper.addObject(
	at IcePack.AdminPrxHelper.addObject(
	at Ice.Application.main(
	at Ice.Application.main(
	at EchoAgent.main(

(icepack config file attached)

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


  • mes
    mes California

    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
  • 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:
    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.