Archived

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

[Another] UnmarshalOutOfBoundsException - A plea for help

Hi guys,

Have been constructing a very simple notification based project as a demonstration of IceStorm, but I have so far been unable to get a two way notification working.

That is, I can call methods through a proxy object fine, so long as they have a void return type. Expecting a result, specifically an int, seems to break the system.
!! 2/05/13 23:46:32:003 UI: error: main: Ice.UnmarshalOutOfBoundsException
       reason = (null)
   	at IceInternal.BasicStream.readInt(BasicStream.java:1274)
   	at CSSE4004._HomeManagerDelM.getTemperature(_HomeManagerDelM.java:49)
   	at CSSE4004.HomeManagerPrxHelper.getTemperature(HomeManagerPrxHelper.java:55)
   	at CSSE4004.HomeManagerPrxHelper.getTemperature(HomeManagerPrxHelper.java:29)
   	at UserInterfaceImpl.run(UserInterfaceImpl.java:23)
   	at Ice.Application.doMain(Application.java:202)
   	at Ice.Application.main(Application.java:182)
   	at Ice.Application.main(Application.java:118)
   	at UserInterfaceImpl.main(UserInterfaceImpl.java:13)

I have searched through previous posts, and it appears that man of the problems were caused by java packages, but I do not believe this is the case with my code - for I have tried incorporating the Ice.Default.Package property in every config file I have, and when that failed, moved all my classes to the top level where a package definition is not required.

Curiously, the __observer object in the PrxHelper generated source is always null, and I am not sure why that is.

I can attach the project if required.

Would anyone happen to know if there is a rookie error I am making, seeing as I am new to Ice?

Cheers

Sam

Comments

  • Additional Informaion

    To make it easier for someone to help, the error also occurs using the demo IceStorm project "clock". If one simply imports the project in Eclipse, changes the tick method to return an int and not void, and sets the default communication to two way, the same error will occur.

    For convenience, here is the project archive with the relevant changes made.

    Attachment not found.

    Thanks,

    Sam
  • Hi,

    the manual:
    "IceStorm messages are unidirectional"
    see IceStorm Concepts - Ice 3.5 - ZeroC
  • I wish I had found that page ages ago. Not only the hours of time it would have saved, but I wouldn't look so foolish.

    Do you know what the correct way to implement a response would be? I could pass in a UUID along with the original message to create a singular topic so that only the sender of the original message will be subscribed to the result, but that seems like the incorrect way to approach the problem.
  • benoit
    benoit Rennes, France
    Hi,

    IceStorm communications are indeed only oneway. You should either make direct two-way calls to each of the subscribers and process each response or use a "reply" interface to get responses from subscribers. For example:
    // Implemented by the publisher, to receive temperatures.
    interface SensorReply {
        void temperature(int t);
    };
    
    // The topic interface, sensors subscribe to this topic.
    interface Sensor {
        void getTemperature(SensorReply* r);
    };
    
    

    Cheers,
    Benoit.
  • Hi Benoit,

    Thanks for the feedback.

    I'll implement a similar system to what you have shown, and get back to you if it works or doesn't.


    Cheers,

    Sam
  • Hi Benoit,

    I've tried building off your code, and using the example from the manual, but after five hours or so I still cannot even reproduce the example found in said wiki to a working state.

    Are there any Java sample projects with this functionality in it that you know of which I could use to figure out what I am doing wrong?

    Cheers,

    Sam
  • benoit
    benoit Rennes, France
    Hi Sam,

    I'd recommend to implement this one step at a time:
    • Implement the sensor and sensor reply interfaces in separate processes and try to get the two to communicate with each other directly (i.e.: without IceStorm). You can use the demo/Ice/callback example for an example very similar to this.
    • Once the above is working, add IceStorm for publishing the "getTemperature" events to the sensors. You can use the Java IceStorm clock demo to figure out how to setup the publisher and subscriber.

    Cheers,
    Benoit
  • Hi Benoit,

    I've finally managed to get all communication channels working.

    Just wanted to thank you for the help.

    Cheers

    Sam