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):
The adapter is correctly registered, but the admin.addObject() call always fails with a DeployementException: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)); } }
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).

Reply With Quote