Results 1 to 1 of 1

Thread: How to add an object to node by using AdminPrx?

  1. #1
    Jiangyubao is offline Registered User
    Name: Yubao Jiang
    Organization: www.gliet.edu.cn
    Project: integrate OSGi & Ice to provice service for PHP
    Join Date
    Oct 2007
    Location
    Beijing China
    Posts
    62

    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:

    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:

    Code:
    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?
    Attached Images Attached Images
    Last edited by Jiangyubao; 05-09-2008 at 05:43 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Howto modify connection timeout for AdminPrx?
    By jharriot in forum Help Center
    Replies: 3
    Last Post: 08-19-2010, 05:53 PM
  2. Find object in object adapter by its proxy
    By dnnbg in forum Help Center
    Replies: 2
    Last Post: 02-25-2009, 04:09 AM
  3. Replies: 1
    Last Post: 11-11-2008, 02:46 PM
  4. How to find an adapter and add object to it?
    By Jiangyubao in forum Help Center
    Replies: 0
    Last Post: 05-20-2008, 11:14 PM
  5. Replies: 2
    Last Post: 06-23-2007, 07:19 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
  •