Archived

This forum has been archived. Please start a new discussion on GitHub.

IceRuby: Ice::ObjectPrx arguments bug?

I have a server with a definition like this:
  interface IndicatorBase {
     void setForwardingProxy(Object* proxy);
  };
From a Ruby, if I establish a connection to the IndicatorBase and attempt to pass an Ice::ObjectPrx as the argument, I get this error:
>> t1.setForwardingProxy( $ic.stringToProxy("Foo") )
NameError: uninitialized constant Ice::ObjectPrx::ICE_TYPE
        from (eval):657:in `invoke'
        from (eval):657:in `setForwardingProxy'
        from (irb):12
($ic is my Ice::Communicator instance)



Note that it works fine if I pass a derived type:
>> t1.setForwardingProxy( $cs )
=> nil
>> $cs.class
=> Gina::DerivedClassPrx

I downgraded to 3.2.0 to see it might be a regression, but I get the same thing in both 3.2.0 and 3.2.1 IceRuby.

Thanks!

Comments

  • matthew
    matthew NL, Canada
    I tried to duplicate your problem with the hello demo and I cannot. However, this is with the Ice current mainline not the 3.2.1 version. What I did was add to the hello interface
    void foo(Object* proxy);
    

    And an implementation that printed the proxy. Then I put near the start of the demo/Ice/hello/Client.rb:
            o = Ice::Application::communicator().stringToProxy('foo:tcp -p 10000')
            puts o
            twoway.foo(o)
    

    This worked as expected. Can you post a complete test case that demonstrates your error please? Also what platform are you using?
  • Thanks for the response, Matthew. This is on Linux, and Ice and IceRuby are basically self compiled.

    I did what you did, adding the foo method to the hello demo, and started the server (after adding the necessary implementation methods for foo(), of course). When I add those lines to the Client.rb client and run it, I get:
    foo -t:tcp -h 127.0.0.1 -p 10000
    foo -t:tcp -h 127.0.0.1 -p 10000
    #<NameError: uninitialized constant Ice::ObjectPrx::ICE_TYPE>
    (eval):61:in `invoke'
    (eval):61:in `foo'
    Client.rb:64:in `run'
    /usr/lib/ruby/site_ruby/1.8/Ice.rb:234:in `main'
    Client.rb:168
    

    Where Hello.ice is:
    module Demo
    {
    
    interface Hello
    {
        void foo(Object* prx);
        ["cpp:const"] idempotent void sayHello(int delay);
        void shutdown();
    };
    
    };
    

    and here are the lines I added to Client.rb starting at line 62:
            o = Ice::Application::communicator().stringToProxy("foo:tcp -p 10000")
            puts o
            twoway.foo(o)
    

    Let me know if I can provide any more information.

    Thanks,
    Caleb
  • matthew
    matthew NL, Canada
    I've verified this bug. Please apply the following patch to ruby/Ice.rb in the distribution. That should sort out your problem.
    index 9ee3d44..d904eca 100644
    --- a/rb/ruby/Ice.rb
    +++ b/rb/ruby/Ice.rb
    @@ -43,7 +43,10 @@ module Ice
         end
     
         T_Object.defineClass(nil, true, nil, [], [])
    +    Object_mixin::ICE_TYPE = T_Object
    +
         T_ObjectPrx.defineProxy(ObjectPrx, T_Object)
    +    ObjectPrx::ICE_TYPE = T_ObjectPrx
     
         #
         # LocalObject.
    
  • Thanks, Matthew. I can confirm this does indeed fix the issue.

    Caleb