Home Help Center

IceStorm Java client: cannot find symbols

DjaunlDjaunl Member Dan GreshOrganization: LLEProject: EP control systems

I'm writing a client to an IceStorm publisher using Java, and I'm pretty much going by the manual on this, as it's my first such IceStorm client. I'm having problems in two areas.

First, in the manual, it says that my class needs to extend a _MonitorDisp. Manual example:
class MonitorI extends _MonitorDisp {

I cannot find any _MonitorDisp class to extend. In my files that were generated from slice2java I have a _NVACMonitorDisp class, but I cannot extend it, as it has final methods:
[javac] /u/dgresh/dev/ice/NVAC/client/NVACObserverClient.java:8: nvac.NVACObserverClient is not abstract and does not override abstract method registerChanged(java.lang.String,int,Ice.Current) in NVAC._NVACMonitorOperations
    [javac] public final class NVACObserverClient extends _NVACMonitorDisp {

I assume this leads up to my second problem. The manual states I need to declare a new Monitor object and instantiate it to my Client class:
Monitor monitor = this;

I cannot find any Monitor symbol, and I get a compiler error telling me so. Does "Monitor" stand for something else, such as my generated Monitor class? If so, I also get a compiler error when I try that, as NVACMonitor.class, which was generated from slice2java, is an interface, not a class.

I'm not getting errors with anything else; I'm just stuck on these two and I'm uncertain where to go from here.

Any help would be greatly appreciated.



  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff

    You should post the Slice file that you're using. It looks like you define a Slice interface named "NVACMonitor" instead of "Monitor".

    The compilation error indicates that you didn't override the abstract methods from the _NVACMonitorOperations generated Java interace in the NVACObserverClient class. You need to override these methods.

    Before trying to write your own subscriber, I recommend you to take a close look at the demo located in the demo/IceStorm/clock directory from your Ice distribution. I'm sure it will answer many of your questions.

  • DjaunlDjaunl Member Dan GreshOrganization: LLEProject: EP control systems
    I will take a look at the demo and follow your advice, then come back with any more questions.

    Thank you for the assistance,
  • DjaunlDjaunl Member Dan GreshOrganization: LLEProject: EP control systems
    Hello again,

    I took a look at the demo files and they were indeed very helpful. I overrode the appropriate method from my _MonitorDisp class, and it allowed me to compile. It seems however that I have a problem subscribing to the topic I need to subscribe to, and this throws an Exception at runtime:
    Topic Manager Proxy: Success
    NVAC TopicName retrieved succesfully
        id.name = "NVAC.TopicName"
        id.category = ""
        facet = ""
        operation = "subscribeAndGetPublisher"
            at IceInternal.Outgoing.invoke(Outgoing.java:148)
            at IceStorm._TopicDelM.subscribeAndGetPublisher(_TopicDelM.java:273)
            at IceStorm.TopicPrxHelper.subscribeAndGetPublisher(TopicPrxHelper.java:307)
            at IceStorm.TopicPrxHelper.subscribeAndGetPublisher(TopicPrxHelper.java:277)
            at nvac.NVACObserverClient.init(Unknown Source)
            at nvac.NVACObserverClient.main(Unknown Source)

    **Note: the first two lines of the compiler output are System.out.printlns I added to make sure I could establish the TopicManager proxy and retrieve the TopicName succesfully.

    I'm not sure what I am doing wrong here, as I've checked my code against the manual and the demo code. Am I creating the servant wrong maybe?

    Here is the relevant portion of my code:
    Ice.ObjectAdapter adapter = ic.createObjectAdapter("MonitorAdapter");
    			NVACMonitor monitor = this;
    			IceStorm.TopicPrx topic = null;
    			try {
    				topic = topicManager.retrieve("NVAC.TopicName");
    				System.err.println("NVAC TopicName retrieved succesfully");
    			} catch (IceStorm.NoSuchTopic e) {
    				System.err.println("No such topic");
    				topic = topicManager.create("NVAC.TopicName");
    			Ice.ObjectPrx subscriber = adapter.addWithUUID(monitor).ice_oneway();
    			try {
    				Map<String, String> qos = null;
    				topic.subscribeAndGetPublisher(qos, subscriber);
    			} catch (IceStorm.AlreadySubscribed e) {
    				System.err.println("Already subscribed to this topic");
    			} catch (IceStorm.BadQoS e) {
    				System.err.println("Quality of Service (QoS) set incorrectly");
    			} catch (Exception e) {

    Thank you for your help,
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    This says that the slice interfaces are not compatible. That is your client is using a different version of the Slice interface than your server. Another possibility is that the object with id "NVAC.TopicName" is not a topic manager (you don't show the code where you get the topicManager -- if you are using a checkedCast this cannot occur).

    My guess is that you are running against an old version of IceStorm. What version of Ice does the IceStorm service come from? What version of Ice is your client using?
  • DjaunlDjaunl Member Dan GreshOrganization: LLEProject: EP control systems

    I am retrieving the values for the topicName and topicManager from a config file, which reads like this:
    Ice.Default.Locator=IceGrid/Locator:default -h localhost -p port
    IceStorm.TopicManager.Proxy=IceStorm/TopicManager:tcp -p port -h localhost
    /* Define IceStorm proxy */
    			Ice.ObjectPrx base = ic.propertyToProxy("IceStorm.TopicManager.Proxy");
    			/* Define the TopicManager for IceStorm */
    			topicManager = IceStorm.TopicManagerPrxHelper.checkedCast(base); //topicManager is a TopicManagerPrx

    About the version information, my client IS running from a newer version than the server is. The server is running on Ice-3.1.0, according to --version. My client is running on Ice-3.2b.

    Is the version causing the problem or is my loading of the topic manager? If it is the version, is there any way to correct this?

  • DjaunlDjaunl Member Dan GreshOrganization: LLEProject: EP control systems
    Hi again,

    I've figured out that it certainly seems to be the version. When I use slice2java from Ice-3.1.0 and try to compile the generated .java files with the Ice-3.2b Ice.jar, it will not work.

    For some reason, the version of Ice-3.1.0 we have does not include an Ice.jar file. I looked in the archives for it and even downloaded Ice-3.1.0, but the version I downloaded did not contain the Ice.jar file (the lib and bin directories were empty). Is there a place where I may download this from?

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Please try your application (client/server/IceStorm) with the latest Ice 3.2.0. Our free support here in these forums is limited to the latest version, except if the problem is not version-specific. For commercial support, which also covers older versions, please contact us at [email protected].
  • DjaunlDjaunl Member Dan GreshOrganization: LLEProject: EP control systems

    I searched around on Zeroc.com a bit and found the version of Ice.jar from Ice-3.1.0 and compiled with that, and everything seems to be working fine now.

    Thank you for your help,
Sign In or Register to comment.