Home Help Center

IceStorm and IceE

Hello I´m making a client in IceE. The client is subscribed to an IceStorm, this is the code in java:

protected void
startApp()
{
mySystem("Empezando startApp");
InputStream is = getClass().getResourceAsStream("config");
Ice.Properties properties = Ice.Util.createProperties();
properties.load(is);
_communicator = Ice.Util.initializeWithProperties(new String[0], properties);


mySystem("Inicializando _monitorPrx");
properties = _communicator.getProperties();
String proxy = properties.getProperty("IceStorm.TopicManager.Proxy");
mySystem("El proxy es "+proxy);
if(proxy == null || proxy.length() == 0)
{
mySystem("Proxy mal obtenido");
}
try
{
Ice.ObjectPrx base = _communicator.stringToProxy(proxy);
/*line 77*/ IceStorm.TopicManagerPrx manager =IceStorm.TopicManagerPrxHelper.checkedCast(base);
}
catch(Exception ex)
{
mySystem("La excepción es "+ex);
return;
}

String market="market";
Map qos = new HashMap();
qos.put("reliability", "batch");

Ice.ObjectAdapterPtr adapter =communicator.createObjectAdapter("Monitor.Suscriber");
Monitor monitor = new MonitorI();

Ice.ObjectPrx proxy = adapter.addWithUUID(monitor);
IceStorm.TopicPrx topic = null;
try {
topic = topicManager.retrieve(market);
topic.subscribe(qos, proxy);
}
catch (Exception ex) {
}
adapter.activate();
_communicator.waitForShutdown();
topic.unsubscribe(proxy);


}

and when I try to compile with build.xml the following errors are thrown:

compile:
[javac] Compiling 1 source file to H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp
\suscrip\classes
[javac] H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp\suscrip\ClientMIDlet.java:
77: package IceStorm does not exist
[javac] IceStorm.TopicManagerPrx manager =IceStorm.TopicManagerP
rxHelper.checkedCast(base);
[javac] ^
[javac] H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp\suscrip\ClientMIDlet.java:
77: package IceStorm does not exist
[javac] IceStorm.TopicManagerPrx manager =IceStorm.TopicManagerP
rxHelper.checkedCast(base);
[javac] ^
[javac] H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp\suscrip\ClientMIDlet.java:
89: cannot resolve symbol
[javac] symbol : class ObjectAdapterPtr
[javac] location: package Ice
[javac] Ice.ObjectAdapterPtr adapter =communicator.createObjectA
dapter("Monitor.Suscriber");
[javac] ^
[javac] H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp\suscrip\ClientMIDlet.java:
89: cannot resolve symbol
[javac] symbol : variable communicator
[javac] location: class ClientMIDlet
[javac] Ice.ObjectAdapterPtr adapter =communicator.createObjectA
dapter("Monitor.Suscriber");
[javac] ^
[javac] H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp\suscrip\ClientMIDlet.java:
92: proxy is already defined in startApp()
[javac] Ice.ObjectPrx proxy = adapter.addWithUUID(monitor);
[javac] ^
[javac] H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp\suscrip\ClientMIDlet.java:
93: package IceStorm does not exist
[javac] IceStorm.TopicPrx topic = null;
[javac] ^
[javac] H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp\suscrip\ClientMIDlet.java:
95: cannot resolve symbol
[javac] symbol : variable topicManager
[javac] location: class ClientMIDlet
[javac] topic = topicManager.retrieve(market);
[javac] ^
[javac] 7 errors

BUILD FAILED

how can I solve it??Is IceE allowed with IceStorm?

Thanks a lot

Comments

  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    Hi,

    Yes, IceE works fine with IceStorm. However, as Mark stated you need to run slice2javae on IceStorm.ice and then compile the generated files yourself along with the rest of your application. You can get copy IceStorm.ice from your Ice distribution.

    Regards,
    Dwayne
  • cesartoviccesartovic Member ✭✭
    Steps??

    Hi,
    I have downloaded Ice 3.
    What is the procedure that I have to follow?Open MS-DOS and in the directory in where is IceStorm.ice put: slice2jave IceStorm.java?Do you have to change the path?
    Thanks
  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    Hi,

    You can run the following commands from your application directory:

    $ slice2javae -I<Ice 3 src path>/slice --ice <Ice src path>/slice/IceStorm/IceStorm.ice
    $ slice2javae -I<Ice 3 src path>/slice --ice <Ice src path>/slice/SliceChecksumDict.ice

    And then make sure the generated java files are compiled along with the rest of your application.

    Regards,
    Dwayne
  • cesartoviccesartovic Member ✭✭
    problem

    Hi, the second order causes the following error:

    H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp\suscrip>slice2javae -I H:/Ice-3.0.1/slice --ice H:/Ice-3.0.1/slice/SliceChecksumDict.ice
    slice2javae: can't open `H:/Ice-3.0.1/slice/SliceChecksumDict.ice' for reading

    what is the problem??
    Thanks a lot
  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    Hi,

    Just a typo, should have been slice/Ice/SliceChecksumDict.ice, not slice/SliceChecksumDict.ice.

    Regards,
    Dwayne
  • cesartoviccesartovic Member ✭✭
    problem succeed

    Ok, this problem is succed. You have to do the same slice2javae... with ObjectAdapter. Is this correct?
    Thanks
  • cesartoviccesartovic Member ✭✭
    I have this problem with this code :
    Ice.ObjectAdapterPtr adapter =_communicator.createObjectAdapter("Monitor.Suscriber");
    Monitor monitor = new MonitorI();

    Ice.ObjectPrx proxy = adapter.addWithUUID(monitor);
    IceStorm.TopicPrx topic = null;
    try {
    topic = topicManager.retrieve(market);
    topic.subscribe(qos, proxy);
    }
    catch (Exception ex) {
    }
    adapter.activate();
    _communicator.waitForShutdown();



    THE ERRORS

    [javac] H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp\suscrip\ClientMIDlet.java:
    cannot resolve symbol
    [javac] symbol : class ObjectAdapterPtr
    [javac] location: package Ice
    [javac] Ice.ObjectAdapterPtr adapter =_communicator.createObject
    ter("Monitor.Suscriber");
    [javac] ^
    [javac] H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp\suscrip\ClientMIDlet.java:
    proxy is already defined in startApp()
    [javac] Ice.ObjectPrx proxy = adapter.addWithUUID(monitor);
    [javac] ^
    [javac] H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp\suscrip\ClientMIDlet.java:
    cannot resolve symbol
    [javac] symbol : variable topicManager
    [javac] location: class ClientMIDlet
    [javac] topic = topicManager.retrieve(market);
    [javac] ^
    [javac] H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp\suscrip\ClientMIDlet.java:
    cannot resolve symbol
    [javac] symbol : method subscribe (java.util.Map,java.lang.String)
    [javac] location: interface IceStorm.TopicPrx
    [javac] topic.subscribe(qos, proxy);
    [javac] ^
    [javac] 4 errors


    I´m desperated!!

    Thanks a lot
  • cesartoviccesartovic Member ✭✭
    Only one problem

    Hi again(sorry)
    I have only one problem with the class ObjectAdapterPtr, how can I solve it?

    [javac] H:\rfranco\Ice\IceEJ-1.0.0\demo\IceE\midp\suscrip\ClientMIDlet.java:
    cannot resolve symbol
    [javac] symbol : class ObjectAdapterPtr
    [javac] location: package Ice
    [javac] Ice.ObjectAdapterPtr adapter =_communicator.createObjectAdapter("Monitor.Suscriber");

    thanks
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    cesartovic wrote:
    I have only one problem with the class ObjectAdapterPtr, how can I solve it?
    ObjectAdapterPtr is a C++ symbol. In Java, you simply use ObjectAdapter.

    Have a look at any of the Java demos to learn more about using Ice.

    - Mark
  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    Hi,

    Just to be clear, you do not need to call slice2cppe on ObjectAdapter.ice. This is already a part of the IceE.jar. Like Mark said, take a look at the other IceE-Java demos for proper usage.

    Regards,
    Dwayne
  • cesartoviccesartovic Member ✭✭
    Thanks A Lot!!

    Thanks a lot, now I have my aplication compiled
Sign In or Register to comment.