Archived
This forum has been archived. Please start a new discussion on GitHub.
How to add an object to node by using AdminPrx?
Hi, all.
I want to deploy applications to servers shown as attachment(ServerTopLogic.png).
I startup icegridregistry and icegridnode at my Linux operating system, and I want to add an object to it, so write the following code:
But the program can't work, and the error message is:
What is the problem?
I want to deploy applications to servers shown as attachment(ServerTopLogic.png).
I startup icegridregistry and icegridnode at my Linux operating system, and I want to add an object to it, so write the following code:
package Demo.main;
import Demo.impl.HelloImpl;
import Ice.ObjectAdapter;
public class AddObject extends Ice.Application {
public int run(String[] args) {
try {
IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper
.checkedCast(communicator().stringToProxy(
"DemoIceGrid/Registry"));
IceGrid.AdminSessionPrx session = registry.createAdminSession(
"foo", "bar");
IceGrid.AdminPrx admin = session.getAdmin();
ObjectAdapter adapter = communicator().createObjectAdapter(
"HelloAdapter");
Ice.Identity ident = communicator().stringToIdentity("HelloObject");
Ice.ObjectPrx factory = adapter.add(new HelloImpl(), ident);
try {
admin.addObject(factory);
} catch (IceGrid.ObjectExistsException e) {
admin.updateObject(factory);
}
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}
public static void main(String[] args) {
AddObject app = new AddObject();
int status = app.main("Admin", args, "client.cfg");
System.exit(status);
}
}
But the program can't work, and the error message is:
Ice.InitializationException
reason = "object adapter "HelloAdapter" requires configuration."
at Ice.ObjectAdapterI.<init>(ObjectAdapterI.java:789)
at IceInternal.ObjectAdapterFactory.createObjectAdapter(ObjectAdapterFactory.java:183)
at Ice.CommunicatorI.createObjectAdapter(CommunicatorI.java:71)
at Demo.main.AddObject.run(AddObject.java:15)
at Ice.Application.main(Application.java:114)
at Ice.Application.main(Application.java:57)
at Demo.main.AddObject.main(AddObject.java:33)
What is the problem?
0