|
|
|
|||||
|
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 |
|
|||||
|
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 |
|
||||||
|
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()); |
|
||||||
|
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 |
|
|||||
|
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, |
|
||||||
|
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 |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |