Archived

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

PropertiesI.cpp:216: Ice::FileException:

Hey-

Due to some reason, I have to run "server" in another directory. The line is as below:

execle("/home/yongsheng/cpp/server", "server", NULL, NULL );

Then I got the following errors:

[root@node124 ~]# server
server: PropertiesI.cpp:216: Ice::FileException:
file exception: No such file or directory
path: config.server

The "config.server" is put in /home/yongsheng/cpp/ with "server".

What can I do on this problem? Thanks.

Yongsheng

Comments

  • benoit
    benoit Rennes, France
    Hi,

    This exception simply indicates that the config.server file can't be found in the current working directory.

    You either need to specify the full path of your configuration file ("/home/yongsheng/cpp/config.server") when you open it in your server or you need to change the current working directory to "/home/yongsheng/cpp/" before doing the execle() (you can change the current working directoy with the chdir() system call).

    Cheers,
    Benoit.
  • Great! Solved by using chdir().

    BTW, does Ice::Application have a daemon that can be started by a call from user space? I mean, the control can be returned to current shell after the "server" is launched? Please note: don't use "&" trailing the command.

    Maybe the description of this question is not clear. If so, just forget it.
  • benoit
    benoit Rennes, France
    Hi,

    No, you shouldn't use Ice::Application if you want to "daemonize" your server. You should use Ice::Service instead. That's what our services (IceGrid, IceBox, IcePatch2, etc) are using to allow them to be either run as Windows services or Unix daemons.

    Another and simpler option is to simply change your server to be an IceBox service. Since the IceBox server is implemented with Ice::Service, you won't have to write any code to allow your service to be "daemonized". You can try this out with the hello IceBox demo located in the demo/IceBox/hello directory of your Ice distrubution.

    See also "8.3.2 The Ice::Service Class" for information on Ice::Service and the Chapter 43 for information on IceBox in the Ice manual.

    Cheers,
    Benoit.