Archived

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

some problem in communication between c++ and java

Hello! I'm just testing the communication between server and client. i choosed the example "Printer" to do this test. at the server i use c++ while at the client i use java.

But i met some problem that is, the client always says "Invalid Proxy". i checked the servant names, that's right. it seems that the problem is in the PrinterPrxHelper.checkedCast. if at the server and at the client both use C++ or java, that's perfect.

I don't know how to solve this problem, please help me. Thank you!

Comments

  • bernard
    bernard Jupiter, FL
    I assume you're trying to run the book/printer demo included in Ice 3.4.0.
            // C++ version
            ic = Ice::initialize(argc, argv);
            Ice::ObjectPrx base = ic->stringToProxy("SimplePrinter:default -p 10000");
            PrinterPrx printer = PrinterPrx::checkedCast(base);
            if(!printer)
            {
                throw "Invalid proxy";
            }
    
            // Java version
            ic = Ice.Util.initialize(args);
            Ice.ObjectPrx base = ic.stringToProxy("SimplePrinter:default -p 10000");
            Demo.PrinterPrx printer = Demo.PrinterPrxHelper.checkedCast(base);
            if(printer == null)
            {
                throw new Error("Invalid proxy");
            }
    

    "Invalid Proxy" means the checkedCast returned 0, which in turns means the target object has not of the expected type.

    Did you make any change to Printer.ice? The Printer.ice in the C++ and the Java version of your demo should be identical.

    Best regards,
    Bernard
  • Thank you! I tried it in some other people's computer and i succeeded.

    I think maybe there is something wrong with my computer, hehe.