Results 1 to 8 of 8

Thread: Problem in execution of QtService

  1. #1
    Join Date
    Jan 2008
    Location
    Bengaluru
    Posts
    144
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question Problem in execution of QtService

    Hi,

    I am using QtService to upload some data into the database. Installation and starting the service works without giving any error. But the logic of uploading the data which is present in the start() method is not happening.

    But, If I ran the same service by giving '-e' as argument, the uploading of data into database happens and the logic just works fine.

    But the former, installation and start of a service ideally should do the work as expected. Is there any thing I forgot to set such the service is not working??

  2. #2
    Join Date
    Jan 2008
    Location
    Bengaluru
    Posts
    144
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Problem in execution of QtService

    I have tried using logMessage(...) to log the event to see whether the control comes to start() method. I checked in windows Event Viewer and there is a message logged confirming the same.

    Now other component I have used is QTimer and have set the Interval to 1 minute. And the timeout is also connected. But the logic of uploading into the DB is not happening.

  3. #3
    Join Date
    Jan 2008
    Location
    Bengaluru
    Posts
    144
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Problem in execution of QtService

    Adding to it!! I have got one more warning message while debugging..

    QTimer::StartTimer can only be used with threads started with QThread..

    My class declaration looks like this,

    Qt Code:
    1. class CUploadService :public QObject, public QtService<QCoreApplication>
    To copy to clipboard, switch view to plain text mode 

    It's a application type not a library. Is that warning message any of the help for me to fix this issue ? Any help guys..

  4. #4
    Join Date
    Jan 2008
    Location
    Bengaluru
    Posts
    144
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Red face Re: Problem in execution of QtService

    At last, the problem solved. The problem lies in the QDir:homePath() while getting the path of the file which has the content for upload. The behaviour is like this,

    Installing a service:
    MyService -i
    QDir::homePath() => D:/Documents and Settings/MyProfileName/

    Starting a service:
    MyService -s
    QDir::homePath() => C:/WINDOWS/system32/config/systemprofile/

    Stopping a service:
    MyService -t
    QDir::homePath() => C:/WINDOWS/system32/config/systemprofile/

    Uninstalling a service:
    MyService -u
    QDir::homePath() => D:/Documents and Settings/MyProfileName/

    The same method returns different location for homePath() if it is service. I don't understand this behaviour of the method. Is this a bug on part of QDir::homePath??

  5. #5
    Join Date
    Feb 2010
    Posts
    7
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Problem in execution of QtService

    Hi nikhilqt,
    I've your same problem, I've a service that install itself, but seems that don't call start method. When I start the service with -e option all go fine.
    I don't understad where's the problem.

    If you found the problem please share it.

    Thanks

  6. #6
    Join Date
    Jan 2008
    Location
    Bengaluru
    Posts
    144
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Problem in execution of QtService

    Quote Originally Posted by maluedo View Post
    I've a service that install itself, but seems that don't call start method. When I start the service with -e option all go fine. I don't understad where's the problem.
    Thanks
    As I mentioned in the earlier post, the problem got solved. The start method was indeed calling but there was a problem in behaviour of QDir::homePath(). Refer my earlier post for the same.

    I used lots of QtService::logMessage(...) method to log messages to unearth the problem. You can use this method calls in QtService::start() method and all other methods to check whether the control is coming and behaving as per your expectation.

    PS: Check the messages in EventViewer in windows os.

  7. #7
    Join Date
    Feb 2010
    Posts
    7
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Problem in execution of QtService

    Thanks for your support,
    I done as you mentioned, I found where's the problem; in the start() I've a class that open through ODBC a visual fox pro database, this open fails!. If I start the service with "-e" flag all go fine.

    I don't understand why. Do you have some tips for me?

  8. #8
    Join Date
    Feb 2010
    Posts
    7
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Problem in execution of QtService

    Found the problem; I was configured the DSN as user and not as system. :-)

Similar Threads

  1. QtService & QtSql
    By acedanans in forum Qt Programming
    Replies: 11
    Last Post: 3rd October 2014, 13:30
  2. QtService Library (dll) for windows
    By ruben.rodrigues in forum Installation and Deployment
    Replies: 1
    Last Post: 22nd October 2010, 20:18
  3. QtService Installation Problem: occurred while nmake.
    By lwinhtooko in forum Installation and Deployment
    Replies: 0
    Last Post: 15th October 2010, 10:20
  4. Problem with build/execution of WinCE application on target device
    By marlag in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 21st July 2009, 14:33
  5. QtService and GAC loadable dll
    By stevey in forum Qt Programming
    Replies: 3
    Last Post: 17th July 2006, 04:39

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.