Archived

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

IcePack Query and Glacier2 question

Greetings..

I am having an issue thrying to add Glacier2 support to the IcePack Simple demo. The Glacier2 service runs fine, but I can not use IcePack Queries through it. This is the error message I get:
C:\Dev\Test>client.exe
.\Outgoing.cpp:359: Ice::ObjectNotExistException:
object does not exist
identity: IcePack/Query
facet:
operation: ice_isA
I have made very few changes to the code:
#include <Ice/Ice.h>
#include <Glacier2/Router.h>
#include <IcePack/Query.h>
#include <Hello.h>
and
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
    Ice::RouterPrx defaultRouter = communicator->getDefaultRouter();
	Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(defaultRouter);

	string username = "test";
	string password = "test";

	try 
	{ 
		router->createSession(username, password);
	}
	
	catch(const Glacier2::PermissionDeniedException& ex)
	{
		cout << "permission denied:\n" << ex.reason << endl;
	}

	catch(const Glacier2::CannotCreateSessionException& ex)
	{
		cout << "cannot create session:\n" << ex.reason << endl;
	}
	
	Ice::PropertiesPtr properties = communicator->getProperties();

    IcePack::QueryPrx query = IcePack::QueryPrx::checkedCast(communicator->stringToProxy("IcePack/Query"));
	Ice::ObjectPrx base = query->findObjectByType("::Demo::Hello");
    HelloPrx twoway = HelloPrx::checkedCast(base->ice_twoway()->ice_timeout(-1)->ice_secure(false));
Other than that all the code is identical. I made sure to link glacier2d.lib. I also made some changes to the config file for the client (config)
#
# The proxy to the Glacier2 router for all outgoing connections. This
# must match the value of Glacier2.Client.Endpoints in config.glacier2.
#
Ice.Default.Router=Glacier2/router:ssl -p 10005

Ice.Default.Locator=IcePack/Locator:default -p 12000

#
# No active connection management is permitted with Glacier2.
# Connections must remain established.
#
Ice.ConnectionIdleTime=0

#
# Ice.MonitorConnections defaults to Ice.ConnectionIdleTime, which we
# set to 0 above. However we still want the connection monitor thread
# for AMI timeouts (for completeness, even if this demo doesn't use
# AMI).
#
Ice.MonitorConnections=60

#
# Connection retry is not possible with Glacier2. Connections must
# remain established.
#
Ice.RetryIntervals=-1

#
# Other settings.
#

#Ice.Trace.Network=1
#Ice.Trace.Protocol=1
Ice.Warn.Connections=1

Ice.Plugin.IceSSL=IceSSL:create
IceSSL.Client.CertPath=certs
IceSSL.Client.Config=sslconfig.xml
IceSSL.Server.CertPath=certs
IceSSL.Server.Config=sslconfig.xml
#IceSSL.Trace.Security=1
and for IcePack (config.icepack)
#
# This configuration file is used to configure an icepack node with a
# collocated registry.
#

#
# Enable ACM.
#
Ice.ConnectionIdleTime=30

#
# IcePack registry configuration
#
IcePack.Registry.Client.Endpoints=default -p 12000
IcePack.Registry.Server.Endpoints=default
IcePack.Registry.Internal.Endpoints=default
IcePack.Registry.Admin.Endpoints=default
IcePack.Registry.Data=db/registry

#
# IcePack node configuration.
#
IcePack.Node.Name=node
IcePack.Node.Endpoints=default
IcePack.Node.Data=db/node
IcePack.Node.CollocateRegistry=1
#IcePack.Node.PropertiesOverride=Ice.Default.Host=127.0.0.1
#IcePack.Node.WaitTime=360

#
# Trace properties to debug activation problems.
#
IcePack.Node.Trace.Activator=2
IcePack.Node.Trace.Adapter=2
IcePack.Node.Trace.Server=2

Ice.Default.Locator=IcePack/Locator:default -p 12000
I am not sure what is causing the error, and I was hoping you could help out. Thanks.

Comments

  • benoit
    benoit Rennes, France
    What is the configuration of the Glacier2 router?

    Note that if you want the communications between the client and IcePack to go through Glacier2, you shouldn't set the default locator property in the client configuration file. Instead you should set it in the Glacier2 router configuration file.

    Benoit.
  • benoit
    benoit Rennes, France
    Btw, could you please fill in your signature with the information requested [thread=1697]here[/thread]? We won't be able to provide more support without this information.

    Thanks,

    Benoit.
  • Sorry, I had forgot to change my signature. Here is the config.glacier2:
    #
    # The client-visible endpoint of Glacier2. This should be an endpoint
    # visible from the public Internet, and it should be secure.
    # 
    Glacier2.Client.Endpoints=ssl -p 10005
    
    #
    # The server-visible endpoint of Glacier2. This endpoint is only
    # required if callbacks are needed (leave empty otherwise). This
    # should be an endpoint on an internal network (like 192.168.x.x), or
    # on the loopback, so that the server is not directly accessible from
    # the Internet.
    #
    Glacier2.Server.Endpoints=tcp -h 127.0.0.1
    
    # 
    # Configure the location of the Ice locator. This must agree with the
    # configuration information in config.icepack.
    #
    Ice.Default.Locator=IcePack/Locator:default -p 12000
    
    # 
    # The proxy of the session manager.
    #
    #Glacier2.SessionManager=ChatSessionManager
    
    # 
    # For this demo, we use a dummy permissions verifier that is
    # collocated with the session server process. This dummy permissions
    # verifier allows any user-id / password combination.
    # 
    #Glacier2.PermissionsVerifier=verifier
    
    #
    # The timeout for inactive sessions. If any client session is inactive
    # for longer than this value, the session expires and is removed. The
    # unit is seconds.
    #
    Glacier2.SessionTimeout=30
    
    #
    # We don't want to allow access to any server back-end objects
    # that do not have the _userId as their category.
    #
    Glacier2.AddUserToAllowCategories=2
    
    #
    # To prevent Glacier2 from being flooded with requests from or to one
    # particular client, Glacier2 can be configured to sleep for a certain
    # period after all current requests for this client have been
    # forwarded. During this sleep period, new requests for the client are
    # queued. These requests are then all sent once the sleep period is
    # over. The unit is milliseconds.
    #
    Glacier2.Client.SleepTime=500
    Glacier2.Server.SleepTime=500
    
    #
    # SSL Settings.
    #
    Ice.Plugin.IceSSL=IceSSL:create
    IceSSL.Client.CertPath=certs
    IceSSL.Client.Config=sslconfig.xml
    IceSSL.Server.CertPath=certs
    IceSSL.Server.Config=sslconfig.xml
    #IceSSL.Trace.Security=1
    
  • I was messing around a bit, and I still can't get this to work right. I even tried using the strings "hello1@Hello" and "hello1:default -h 127.0.0.1 -p 12000" but this also did not work. I keep getting object not found errors. Is there something special I have to do to get proxy from beyond the router?
  • marc
    marc Florida
    You have this set in your Glacier2 configuration:
    #
    # We don't want to allow access to any server back-end objects
    # that do not have the _userId as their category.
    #
    Glacier2.AddUserToAllowCategories=2
    

    Therefore you can only access objects that have an identity with a category that equals "_" plus the user id ("_test" in your example). You can trace this behavior by setting Glacier2.Client.Trace.Reject=1.

    For more information, please see the Ice user manual, and our newsletter issue #1 and #2. (http://www.zeroc.com/newsletter/)
  • Thank you marc! That fixed my problem!