Archived
This forum has been archived. Please start a new discussion on GitHub.
IceStorm and Services inside a IceGrid
Hello, I'm a new Ice User, and I'm trying to develop an application (Server and Cilent) where I would have 1 Service (HelloService) that expone a function 'Hello', and a Thread that publish on a IceStorm Topic the current time every second.
Server Side, I have written the code in C++, and I'm trying to develop the client in Java.
I start IceGrid with this cfg file:
After I have registered this application.xml:
Where Demo::Hello is the service, and Demo::Clock is the Topic Publisher.
Until here, Everything appear to work correctly:
But now, I can't subscribe the IceStorm Topic from My Java code:
This is my configuration:
This is the subscriber code
When I call communicator().createObjectAdapter I Get this Exception:
Ice.InitializationException
reason = "object adapter `Clock.Subscriber' requires configuration"
Any ideas?
Thanks!
Server Side, I have written the code in C++, and I'm trying to develop the client in Java.
I start IceGrid with this cfg file:
IceGrid.InstanceName=AtsGrid Ice.Default.Locator=AtsGrid/Locator:default -p 4061 IceStorm.TopicManager.Proxy=IceStorm/TopicManager IceGrid.Registry.DefaultTemplates=C:\Program Files\ZeroC\Ice-3.4.1\config\templates.xml IceGrid.Registry.Client.Endpoints=default -p 4061 IceGrid.Registry.Server.Endpoints=default IceGrid.Registry.Internal.Endpoints=default IceGrid.Registry.Data=db/registry IceGrid.Registry.PermissionsVerifier=AtsGrid/NullPermissionsVerifier IceGrid.Registry.AdminPermissionsVerifier=AtsGrid/NullPermissionsVerifier IceGrid.Registry.SSLPermissionsVerifier=AtsGrid/NullSSLPermissionsVerifier IceGrid.Registry.AdminSSLPermissionsVerifier=AtsGrid/NullSSLPermissionsVerifier IceGrid.Node.Name=node1 IceGrid.Node.Endpoints=default IceGrid.Node.Data=db/node IceGrid.Node.CollocateRegistry=1 IceGrid.Node.Trace.Activator=1 IceGridAdmin.Username=foo IceGridAdmin.Password=bar
After I have registered this application.xml:
<icegrid> <application name="Simple" import-default-templates="true"> <node name="node1"> <server-instance template="IceStorm" instance-name="IceStorm"/> <server id="SimpleServer" exe=".\bind\server_prova" activation="always"> <adapter name="Hello" endpoints="tcp"> <object identity="hello" type="::Demo::Hello" property="Identity"/> </adapter> <adapter name="Clock" endpoints="tcp"> <object identity="clock" type="::Demo::Clock" property="Identity"/> </adapter> </server> </node> </application> </icegrid>
Where Demo::Hello is the service, and Demo::Clock is the Topic Publisher.
Until here, Everything appear to work correctly:
C:\Project\atsGrid\cpp\atsNode>icegridnode --Ice.Config=grid.cfg -- 11/02/11 17:39:20.048 icegridnode: Activator: activating server `SimpleServer' -- 11/02/11 17:39:20.095 icegridnode: Activator: activating server `IceStorm' Just pubblished : 11/02/11 17:39:20.313 Just pubblished : 11/02/11 17:39:21.343 Just pubblished : 11/02/11 17:39:22.357 Just pubblished : 11/02/11 17:39:23.371 Just pubblished : 11/02/11 17:39:24.385 Just pubblished : 11/02/11 17:39:25.399
But now, I can't subscribe the IceStorm Topic from My Java code:
This is my configuration:
Ice.Default.Locator=AtsGrid/Locator:default -p 4061 IceStorm.TopicManager.Proxy=IceStorm/TopicManager
This is the subscriber code
String topicName = "time"; String option = "None"; boolean batch = false; String id = null; String retryCount = null; int i; if(batch && (option.equals("Twoway") || option.equals("Ordered"))) { System.err.println(appName() + ": batch can only be set with oneway or datagram"); return 1; } IceStorm.TopicManagerPrx manager = IceStorm.TopicManagerPrxHelper.checkedCast( communicator().stringToProxy("IceStorm/TopicManager")); if(manager == null) { System.err.println("invalid proxy"); return 1; } try { topic = manager.retrieve(topicName); } catch(IceStorm.NoSuchTopic e) { try { topic = manager.create(topicName); } catch(IceStorm.TopicExists ex) { System.err.println(appName() + ": temporary failure, try again."); return 1; } } adapter = communicator().createObjectAdapter("Clock.Subscriber");
When I call communicator().createObjectAdapter I Get this Exception:
Ice.InitializationException
reason = "object adapter `Clock.Subscriber' requires configuration"
Any ideas?
Thanks!
0
Comments
-
Addendum
I developed my examples following this thread:
http://www.zeroc.com/forums/help-center/3571-icegrid-icestorm-example.html
Any Ideas?0 -
Hi
You need to configure the endpoints for the object adapter named "Clock.Subscriber" from your subscriber. You can either do this with properties by setting the property Clock.Subscriber.Endpoints=tcp or by using the createObjectAdapterWithEndpoints("Clock.Subscriber", "tcp") communicator call.
Cheers,
Benoit.0 -
Hi Benoit,
thanks for your answer. Now my example work very well!!
Greetings
Alessandro0