Archived
This forum has been archived. Please start a new discussion on GitHub.
having issue with on-demand activation
Hello,
I am trying to make my server "on-demand".
Status:
1) client and server run fine, when both started manually.
2) Added the application (application.xml) to the IcePackRegistry.
3) Can start/activate the server via the IcePackNode from the IcePackAdmin (ie "server start" command)
4) Ran successfully run the client after #3 above.
But, when I just try to run the client, and the server is not running...the server never gets launched by the IcePackNode.
I set the trace on (IcePack.Node.Trace.Activator=3), but it seems like the Client is never getting in touch directly or indirectly with the IcePackNode.
I am sure its a configuration issue, but I have poured over the documentation and cant find my issue.
Any thoughts?
BTW,
Ice is very cool! I have done alot of CORBA previously and I can see why Ice is gaining so much momentum, so quickly!
Thanks!
Bob
I am trying to make my server "on-demand".
Status:
1) client and server run fine, when both started manually.
2) Added the application (application.xml) to the IcePackRegistry.
3) Can start/activate the server via the IcePackNode from the IcePackAdmin (ie "server start" command)
4) Ran successfully run the client after #3 above.
But, when I just try to run the client, and the server is not running...the server never gets launched by the IcePackNode.
I set the trace on (IcePack.Node.Trace.Activator=3), but it seems like the Client is never getting in touch directly or indirectly with the IcePackNode.
I am sure its a configuration issue, but I have poured over the documentation and cant find my issue.
Any thoughts?
BTW,
Ice is very cool! I have done alot of CORBA previously and I can see why Ice is gaining so much momentum, so quickly!
Thanks!
Bob
0
Comments
-
Bob,
Welcome to the forum!
There are a couple of things you can check:
1) Does the client's configuration define Ice.Default.Locator appropriately?
2) When you run the client with --Ice.Trace.Network=2, to which address is the client attempting to connect? Is it the locator's address?
If you're still having trouble, please provide at least the following information:- The version of Ice you are using, as well as which language mapping(s).
- The platform and compiler you are using.
- The configuration properties for client, IcePack and server.
- A description (or a copy) of the stringified proxy the client is using.
Take care,
- Mark0 -
Mark,
I did as you suggested and verfified that the Locator is being contacted on port 12000.
I also did some more investigating, and now I am getting the server to launch based on a client request!
The last issue is that the server launches, BUT the client hangs.
It launches the server on a "stringToProxy" request in an effort to obtain a remote reference to one of the server-side objects.
That causes the server to launch, but the call never seems to complete as far as the client is concerned.
Is it a threading issue?
Does the server need to go into its "waitForShutdown()" loop in a seperate thread?
Again, If I launch the server manually or via a "server start" IcePackAdmin command, and then start the client...everythings works great.
I am running Ice Java v2.0 ...both client and server on Windows XP.
Any thoughts?
Thanks!
Bob0 -
Originally posted by BobDeAnna
I also did some more investigating, and now I am getting the server to launch based on a client request!That causes the server to launch, but the call never seems to complete as far as the client is concerned.
Usually this "hang" occurs because the server forgot to activate its object adapter, but since it works fine in other situations I doubt that's the problem.Is it a threading issue?
Does the server need to go into its "waitForShutdown()" loop in a seperate thread?Again, If I launch the server manually or via a "server start" IcePackAdmin command, and then start the client...everythings works great.
- Mark0 -
Mark,
Here is the adapter defined in the Registry:
adapter 'localhost.AdminLoginManager'
{
id = 'InfrastructureManagerServer.localhost.AdminLoginManager'
endpoints = 'tcp -p 10000'
register process = 'true'
object
{
proxy = 'localhost.adminLoginManager -t @ InfrastructureManagerServer.localhost.AdminLoginManager'
type = '::AdminLoginManager'
}
}
Here are the 3 config file options I tested:
1 localhost.AdminLoginManager.Proxy=localhost.adminLoginManager (adapter name w/out endoints)
2 localhost.AdminLoginManager.Proxy=InfrastructureManagerServer.localhost.AdminLoginManager (adapter id)
3 localhost.AdminLoginManager.Proxy=localhost.adminLoginManager:tcp -p 10000 (adapter name w/endpoints)
When I run the client with option #1, the server does get auto-launched....but it hangs checkedCast() the proxy after
obtaining it from a stringToProxy().
I ultimately get a Ice.NoEndpointException
Below is the trace:
getting adminLoginManagerProxy with name 'localhost.adminLoginManager'
got adminLoginManagerProxy
[ Network: tcp connection established
local address = 10.16.95.58:1820
remote address = 10.16.95.58:12000 ]
[ Protocol: received validate connection
message type = 3 (validate connection)
compression status = 0 (not compressed; do not compress response, if any)
message size = 14 ]
[ Protocol: sending request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 87
request id = 1
identity = IcePack/Locator
facet =
operation = findObjectById
mode = 1 (nonmutating)
context = ]
[ Protocol: received reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 114
request id = 1
reply status = 0 (ok) ]
[ Protocol: sending request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 115
request id = 2
identity = IcePack/Locator
facet =
operation = findAdapterById
mode = 1 (nonmutating)
context = ]
[ Protocol: received reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 27
request id = 2
reply status = 0 (ok) ]
[ Protocol: sending request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 87
request id = 3
identity = IcePack/Locator
facet =
operation = findObjectById
mode = 1 (nonmutating)
context = ]
[ Protocol: received reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 114
request id = 3
reply status = 0 (ok) ]
[ Protocol: sending request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 115
request id = 4
identity = IcePack/Locator
facet =
operation = findAdapterById
mode = 1 (nonmutating)
context = ]
[ Protocol: received reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 27
request id = 4
reply status = 0 (ok) ]
Exception in thread "main" Ice.NoEndpointException
proxy = "localhost.adminLoginManager -t @ "
at IceInternal.Reference.getConnection(Reference.java:562)
at Ice._ObjectDelM.setup(_ObjectDelM.java:196)
at Ice.ObjectPrxHelperBase.__getDelegate(ObjectPrxHelperBase.java:640)
at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:41)
at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:29)
at InfrastructureMgmt.AdminLoginManagerPrxHelper.checkedCast(AdminLoginM
anagerPrxHelper.java:189)
at InfrastructureMgmt.client.IceClient.getAdminLoginMangerProxy(IceClien
t.java:81)
at InfrastructureMgmt.client.IceClient.connectToMachine(IceClient.java:1
99)
at InfrastructureMgmt.client.IceClientManager.getIceClient(IceClientMana
ger.java:54)
at InfrastructureMgmt.ui.FileTree$FileTreeNode.<init>(FileTree.java:71)
at InfrastructureMgmt.ui.FileTree.<init>(FileTree.java:27)
at InfrastructureMgmt.ui.InfrastructureManagerController.<init>(Infrastr
uctureManagerController.java:169)
at InfrastructureMgmt.ui.InfrastructureManager.main(InfrastructureManage
r.java:15)
[ Protocol: sending close connection
message type = 4 (close connection)
compression status = 0 (not compressed; do not compress response, if any)
message size = 14 ]
[ Network: closing tcp connection
local address = 10.16.95.58:1820
remote address = 10.16.95.58:12000 ]
When I try #2:
I get a Ice.NotRegisteredException exception
When I try #3:
I get a Ice.ConnectionRefusedException
#3 works fine when I run the Server "stand-alone" or if I launch it with the "server start" command.
That was the one I tried initially with on-demand activation.
I assume there is a source code/config/registry combination that works for both manual and on-demand.
As you can see, I am confused!
Thanks,
Bob0 -
Hi Bob,
From your description, it appears that you have a well-known object whose identity is localhost.adminLoginManager and a well-known adapter named localhost.AdminLoginManager whose id is InfrastructureManagerServer.localhost.AdminLoginManager.
This configuration allows you to compose indirect proxies as follows:- localhost.adminLoginManager - resolves the well-known object
- object-id @ InfrastructureManagerServer.localhost.AdminLoginManager - resolves an arbitrary object at the well-known adapter
It is difficult to diagnose the connection problems further without seeing a complete example that includes the client and server source code as well as the IcePack configuration files. One thing to check however is whether your server is creating the adapter with the name localhost.AdminLoginManager, such as
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("localhost.AdminLoginManager");
- Mark0 -
Mark,
What you describe makes perfect sense.
I am just not sure why I can't autolaunch with #1 or #3.
Below (and attached) is the information you request.
Let me know...if you need anything else.
ICEPACK CONFIG:
#
# The IcePack locator proxy.
#
Ice.Default.Locator=IcePack/Locator:default -p 12000
#
# 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=localhost
IcePack.Node.Endpoints=default
IcePack.Node.Data=db/localhost
IcePack.Node.CollocateRegistry=1
IcePack.Node.Trace.Activator=3
CLIENT/SERVER CONFIG:
Ice.Default.Locator=IcePack/Locator:default -p 12000
#localhost.AdminLoginManager.Proxy=localhost.adminLoginManager
#localhost.AdminLoginManager.Proxy=InfrastructureManagerServer.localhost.AdminLoginManager
localhost.AdminLoginManager.Proxy=localhost.adminLoginManager:tcp -p 10000
localhost.AdminLoginManager.Endpoints=tcp -p 10000
machineName=localhost
#
# Warn about connection exceptions
#
Ice.Warn.Connections=1
Ice.ConnectionIdleTime=10
#
# Network Tracing
#
# 0 = no network tracing
# 1 = trace connection establishment and closure
# 2 = like 1, but more detailed
# 3 = like 2, but also trace data transfer
#
Ice.Trace.Network=1
#
# Protocol Tracing
#
# 0 = no protocol tracing
# 1 = trace protocol messages
#
Ice.Trace.Protocol=1
#
# Security Tracing
#
# 0 = no security tracing
# 1 = trace warning messages
# 2 = config file parsing warnings
#
#Ice.Trace.Security=2
SERVER CODE:
public static final String adminLoginManagerProxyPropertyName = ".AdminLoginManager";
public static final String adminLoginManagerProxyPropertyIdentity = ".adminLoginManager";
public void createAdminLoginManager()
{
System.out.println(" creating AdminLoginManager adaptor ");
adminLoginManagerAdapter = communicator.createObjectAdapter(machineName + adminLoginManagerProxyPropertyName);
System.out.println(" created AdminLoginManager adaptor ");
adminLoginManagerImpl = new AdminLoginManagerImpl();
System.out.println(" created AdminLoginManagerImpl ");
adminLoginManagerAdapter.add(adminLoginManagerImpl, Ice.Util.stringToIdentity(machineName + adminLoginManagerProxyPropertyIdentity));
System.out.println(" added AdminLoginManagerImpl to adapter");
adminLoginManagerAdapter.activate();
System.out.println(" activated AdminLoginManagerImpl");
System.out.println("");
}
CLIENT CODE:
public static final String adminLoginManagerProxyProperty = ".AdminLoginManager.Proxy";
public AdminLoginManagerPrx getAdminLoginMangerProxy()
{
if (adminLoginManager != null)
return adminLoginManager;
String propertyName = machineName + adminLoginManagerProxyProperty;
adminLoginManagerProxy = IceClientManager.properties.getProperty(propertyName);
if(adminLoginManagerProxy.length() == 0)
{
System.err.println("adminLoginManagerProxy property `" + propertyName + "' not set");
return null;
}
System.err.println("getting adminLoginManagerProxy with name '" + adminLoginManagerProxy + "'");
Ice.ObjectPrx base = IceClientManager.communicator.stringToProxy(adminLoginManagerProxy);
System.err.println("got adminLoginManagerProxy");
adminLoginManager = AdminLoginManagerPrxHelper.checkedCast(base.ice_twoway().ice_timeout(-1).ice_secure(false));
if(adminLoginManager == null)
{
System.err.println("invalid adminLoginManagerProxy");
return null;
}
System.err.println("narrowed adminLoginManagerProxy");
System.err.println("");
return adminLoginManager;
}
Thanks,
Bob0 -
Bob,
I don't see anything unusual. Can you also provide the IcePack XML configuration file(s)?
- Mark0 -
Mark,
Sure....its below and attached.
<icepack>
<application name="InfrastructureManager">
<node name="localhost">
<server name="InfrastructureManagerServer" kind="java"
classname="InfrastructureMgmt.impl.InfrastructureMgmtServer"
pwd=".."
activation="on-demand">
<adapters>
<adapter name="localhost.AdminLoginManager" endpoints="tcp -p 10000" register="true">
<object identity="localhost.adminLoginManager" type="::AdminLoginManager"/>
</adapter>
</adapters>
</server>
</node>
</application>
</icepack>
Thanks!
Bob0 -
Hi,
I tried to reproduce this locally and encountered several errors using your configuration. I suspect it is these errors that are causing your problems.
First of all, your client should be using one of the following proxies:localhost.AdminLoginManager.Proxy=localhost.adminLoginManager localhost.AdminLoginManager.Proxy=localhost.adminLoginManager @ InfrastructureManagerServer.localhost.AdminLoginManager
The proxy that specifies an explicit endpoint will not cause the server to be activated on demand (because the proxy is not resolved by the locator, and therefore IcePack doesn't know that the server needs to be activated). The client should correctly get a ConnectionRefusedException in that case, or it might even connect successfully if you've accidentally left a manually-launched server running.
Second, the fact that you've specified pwd=.. for the server's working directory causes subtle problems when the server is launched. You have specified a relative path for the IcePack database directories, therefore when IcePack attempts to launch the server, it passes an argument like --Ice.Config=db/node/servers/InfrastructureManagerServer/config/config to the server. Of course, since the server starts in the directory above the node's directory, the server won't find the configuration file and startup will fail. If you watch the output of IcePack node when tracing is enabled, you will see the arguments being passed to the server and the subsequent failure messages.
To solve this problem you must either remove the pwd=.. option or, if you want to keep that option, you must change the IcePack database directories in your configuration file to have absolute pathnames. If you change the directories, you must also stop the IcePack node, remove the existing IcePack database directories, recreate them, and redeploy the application.
Also be sure that your CLASSPATH contains absolute pathnames, and that the IcePack node is restarted with the correct CLASSPATH settings.
Take care,
- Mark0 -
Mark,
Again your explanation makes prefect sense.
I made the changes suggested:
1) changed config file as follows:
...
localhost.AdminLoginManager.Proxy=localhost.AdminLoginManager.Proxy=localhost.adminLoginManager @ InfrastructureManagerServer.localhost.AdminLoginManager
...
2) changed "pwd" of application.xml to be a full path:
...
pwd="C:\eclipse\workspace\InfrastructureMgmt"
...
3) re-ran client
The server DID get launched...but the client hung again, and ultimately I got the "NoEndPointException"
SERVER CONSOLE:
C:\eclipse\workspace\InfrastructureMgmt\icePack>icepacknode --Ice.Config=config
icepacknode: warning: administrative endpoints `IcePack.Registry.Admin.Endpoints
' enabled
[ icepacknode: Activator: activating server `InfrastructureManagerServer'
path = C:\WINDOWS\System32\java.exe
pwd = C:\eclipse\workspace\InfrastructureMgmt
args = -ea InfrastructureMgmt.impl.InfrastructureMgmtServer --Ice.Config=db/l
ocalhost/servers/InfrastructureManagerServer/config/config --Ice.Default.Locator
=IcePack/Locator:default -p 12000 --Ice.ServerId=InfrastructureManagerServer ]
[ icepacknode: Activator: activated server `InfrastructureManagerServer' (pid =
6140) ]
machine name is localhost
creating AdminLoginManager adaptor
created AdminLoginManager adaptor
created AdminLoginManagerImpl
added AdminLoginManagerImpl to adapter
activated AdminLoginManagerImpl
CLIENT CONSOLE:
IceClient constructor localhost
getting adminLoginManagerProxy with name 'localhost.AdminLoginManager.Proxy=loca
lhost.adminLoginManager @ InfrastructureManagerServer.localhost.AdminLoginManage
r'
got adminLoginManagerProxy
Exception in thread "main" Ice.NoEndpointException
InfrastructureManagerServer.localhost.AdminLoginManager"
at IceInternal.Reference.getConnection(Reference.java:562)
at Ice._ObjectDelM.setup(_ObjectDelM.java:196)
at Ice.ObjectPrxHelperBase.__getDelegate(ObjectPrxHelperBase.java:640)
at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:41)
at Ice.ObjectPrxHelperBase.ice_isA(ObjectPrxHelperBase.java:29)
at InfrastructureMgmt.AdminLoginManagerPrxHelper.checkedCast(AdminLoginM
anagerPrxHelper.java:189)
at InfrastructureMgmt.client.IceClient.getAdminLoginMangerProxy(IceClien
t.java:81)
at InfrastructureMgmt.client.IceClient.connectToMachine(IceClient.java:1
99)
at InfrastructureMgmt.client.IceClientManager.getIceClient(IceClientMana
ger.java:54)
at InfrastructureMgmt.ui.FileTree$FileTreeNode.<init>(FileTree.java:71)
at InfrastructureMgmt.ui.FileTree.<init>(FileTree.java:27)
at InfrastructureMgmt.ui.InfrastructureManagerController.<init>(Infrastr
uctureManagerController.java:171)
at InfrastructureMgmt.ui.InfrastructureManager.main(InfrastructureManage
r.java:15)
REGISTRY DESCRIPTION:
server 'InfrastructureManagerServer' (Java)
{
node = 'localhost'
application = 'InfrastructureManager'
exe = 'java'
pwd = 'C:\eclipse\workspace\InfrastructureMgmt'
activation = 'on-demand'
className = 'InfrastructureMgmt.impl.InfrastructureMgmtServer'
adapter 'localhost.AdminLoginManager'
{
id = 'InfrastructureManagerServer.localhost.AdminLoginManager'
endpoints = 'tcp -p 10000'
register process = 'true'
object
{
proxy = 'localhost.adminLoginManager -t @ InfrastructureManagerServe
r.localhost.AdminLoginManager'
type = '::AdminLoginManager'
}
}
Questions:
Should I turn on tracing and provide client and server log files?
Any thoughts?
Thanks for all of your time and help!
Bob0 -
Mark,
I also tried running the client out of the same directory as IcePackNode...with pwd not set.
I got the same results....server getting launched, but then the client hanging and then getting a "NoEndPointException".
Attached is the config file that IcePack generated in:
C:\eclipse\workspace\InfrastructureMgmt\icePack\db\localhost\servers\InfrastructureManagerServer\config
Thanks,
Bob0 -
Bob,
I still don't see anything obviously wrong from the information you've provided. The quickest way to a resolution is for you to provide an archive containing the source code of a small client-server example (with as few external dependencies as possible) that reproduces the problem, including configuration files, XML files, etc.
If you'd prefer not to post that archive on the forum, feel free to send it to me directly.
- Mark0