Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 07-18-2005
jaggu jaggu is offline
Registered User
 
Name: Todd M
Organization: Inc
Project: Testing
 
Join Date: Jul 2005
Posts: 11
Getting Couldn't invoke on the object to get its interface while binding to IcePack

Folks,
I am tring to bind a object to IcePack, seems like I have wrong Sequence or something.
Here is what I am doing:

Ice.Object object = new ThroughputI();
Identity id = Ice.Util.stringToIdentity("MyThroughput") ;
Ice.ObjectPrx objPtr = adapter.add(object, id);
adapter.activate();

IcePack.AdminPrx admin = IcePack.AdminPrxHelper.checkedCast(communicator.st ringToProxy("IcePack/Admin"));

admin.addObject(objPtr);


Thanks
Reply With Quote
  #2 (permalink)  
Old 07-18-2005
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: 971
Hi,

I don't see anything wrong with your code, so please provide more details about your problem. Are you getting an exception? If so, it would be helpful to see it. Is this code failing? Or is another application unable to locate the object you've registered?

Please also describe your environment: Ice version, operating system, compiler, etc.

Take care,
- Mark
Reply With Quote
  #3 (permalink)  
Old 07-18-2005
jaggu jaggu is offline
Registered User
 
Name: Todd M
Organization: Inc
Project: Testing
 
Join Date: Jul 2005
Posts: 11
I am on windows 2000, Ice 2.1.2. JDK 1.4.2. This is the first app I am writing, meaning it was never working for me.

The Exception I get is

ERROR Server 15:14:24.265 - AJAGLAN2-2K|test IcePack.DeploymentException
reason = "Couldn't invoke on the object to get its interface."
IcePack.DeploymentException
reason = "Couldn't invoke on the object to get its interface."
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Construc tor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at IceInternal.BasicStream$DynamicUserExceptionFactor y.createAndThrow(BasicStream.java:2011)
at IceInternal.BasicStream.throwException(BasicStream .java:1413)
at IcePack._AdminDelM.addObject(_AdminDelM.java:91)
at IcePack.AdminPrxHelper.addObject(AdminPrxHelper.ja va:70)
at IcePack.AdminPrxHelper.addObject(AdminPrxHelper.ja va:54)
at Server.run(Server.java:24)
at Server.main(Server.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main (AppMain.java:78)


I tried Tie approach also.

My code is: Server.java

Ice.ObjectAdapter adapter = communicator.createObjectAdapter("Throughput");
Ice.Object object = new _ThroughputTie( new ThroughputI());
ObjectPrx objPtr = adapter.add(object, Ice.Util.stringToIdentity(SecurityId.class.getName ()));
adapter.activate();
IcePack.AdminPrx admin = IcePack.AdminPrxHelper.checkedCast(communicator.st ringToProxy("IcePack/Admin"));
admin.addObject(objPtr);
communicator.waitForShutdown();




public final class ThroughputI implements _ThroughputOperations {
...
}

Thanks,
Anil
Reply With Quote
  #4 (permalink)  
Old 07-18-2005
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,540
It looks like IcePack failed to get the type of your object. Unfortunately it doesn't say why (we will fix this). It could be because your object adapter endpoints are not accessible to the IcePack registry process (IcePack needs to establish a connection to your server in order to get the type of the object). If you're willing to re-compile IcePack to figure this out, you could print the exception that IcePack catches in Ice-2.1.2/src/IcePack/AdminI.cpp line 1402.

Otherwise, to avoid IcePack to remotely call on your object to get its type, you could use the IcePack::Admin::addObjectWithType() method, for example:

Code:
Ice.Object object = new ThroughputI();
...
admin.addObjectWithType(objPtr, object->ice_id());
Benoit.
Reply With Quote
  #5 (permalink)  
Old 07-18-2005
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: 971
Hi,

When you register an object with IcePack using addObject, the IcePack registry tries to determine the object's type by calling ice_id on it. The exception indicates that this attempt failed. This could happen when the server is not running at the time the object is registered. It could also happen if the server's object adapter does not have its endpoints configured properly when the IcePack service is running on a different host.

I suggest running your server as well as the IcePack registry with the property Ice.Trace.Network=2. If you're still having trouble, please post the trace messages.

Take care,
- Mark
Reply With Quote
  #6 (permalink)  
Old 07-18-2005
jaggu jaggu is offline
Registered User
 
Name: Todd M
Organization: Inc
Project: Testing
 
Join Date: Jul 2005
Posts: 11
Thanks for the quick reply.

I did:
Identity id = new Identity() ;
id.name = SecurityId.class.getName() ;
ObjectPrx objPtr = adapter.add(object, id);
adapter.activate();
IcePack.AdminPrx admin = IcePack.AdminPrxHelper.checkedCast(communicator.st ringToProxy("IcePack/Admin"));
admin.addObjectWithType(objPtr, object.ice_id());
System.out.println("Id: " + object.ice_id());

For some reason the "Id: " is printing :emo::Throughput. I was expecting "SecurityId". as this was name I intended.

Anyways the client is notable to resolve this name.
IcePack.QueryPrx query = IcePack.QueryPrxHelper.checkedCast(communicator.st ringToProxy("IcePack/Query"));
Identity id = Ice.Util.stringToIdentity(":emo::Throughput") ;

Ice.ObjectPrx base= query.findObjectById(id) ;

I get:
IcePack.QueryPrx query = IcePack.QueryPrxHelper.checkedCast(communicator.st ringToProxy("IcePack/Query"));
//Identity id = Ice.Util.stringToIdentity(SecurityId.class.getName ()) ;
Identity id = Ice.Util.stringToIdentity(":emo::Throughput") ;

Ice.ObjectPrx base= query.findObjectById(id) ;


Thanks again,
Reply With Quote
  #7 (permalink)  
Old 07-18-2005
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: 971
Hi,

There are two "ids" and it can be easy to get them confused. The first is the object identity, which you are defining as SecurityId.class.getName(). The second is the object's type id, which is the value returned by ice_id and represents the most-derived Slice interface or class implemented by the object. The IcePack operation findObjectById really should be named findObjectByIdentity, as that is how it actually works. The findObjectByType operation uses the type id, which in this case is "::Demo::Throughput".

So, doing the following should work (assuming that you've got your endpoints and IcePack configured correctly):

Identity id = Ice.Util.stringToIdentity(SecurityId.class.getName ()) ;
Ice.ObjectPrx base= query.findObjectById(id) ;
Demo.ThroughputPrx t = Demo.ThroughputPrxHelper.checkedCast(base);

Take care,
- Mark
Reply With Quote
  #8 (permalink)  
Old 07-18-2005
jaggu jaggu is offline
Registered User
 
Name: Todd M
Organization: Inc
Project: Testing
 
Join Date: Jul 2005
Posts: 11
Thanks Mes. Awesome !!

I can get it working by adding
Throughput.Throughput=throughput:default
Throughput.Endpoints=default

A minor thing though, shouldn't we default them.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding Client to Interface wgwolf Help Center 1 10-24-2006 05:24 AM
icepack proxy binding gminorcoles Help Center 4 07-07-2005 02:20 PM
About Direct Binding and Indirect Binding eyexercise Help Center 0 12-02-2004 03:57 AM
Unable to register object in icepack registry annekat Help Center 2 11-26-2004 07:01 PM
Class/Interface Confusion with IcePack amrufon Help Center 2 07-14-2004 06:12 AM


All times are GMT -4. The time now is 10:34 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.