Qt-solutions Archive, February 2007
QT Service Question
Message 1 in thread
I currently have a qt application that works great. It uses a bunch of
the network calls, runs on mac, windows, linux like a champ. mostly it
processes data in the background with only a splash screen and progress
bar as a UI. its really just a way to distribute processing workload for
a large number crunching application.
My client would like to run it as a "service" on the linux box without a
GUI. He's got a valid reason for this and it makes sense to me.
So since I've never written a "service" before, I thought i'd use the
QTSolution QTService as a model and just build on it.
But I'm having a heck of a time just understanding the architecture of
the examples and actually running them. I tried the "interactive"
service. Imported the .pro file to a Visual Studio 2003.net and did a
successful build. When I run it, a dos window pops up and then closes
(really fast) and the program terminates with an error code that means
nothing:
The program '[1900] interactive.exe: Native' has exited with
code -2147483645 (0x80000003).
Has anyone had better luck with this stuff? I expected to see a gui from
this example but nothing showed up. I'm not sure what the command line
argument is actually supposed to be when this starts. I've sent a
request to support@trolltech, but haven't heard back yet.
thanks in advance!
Charley Burns
Message 2 in thread
Message>But I'm having a heck of a time just understanding the architecture
of the examples and actually running them. I >tried the "interactive"
service. Imported the .pro file to a Visual Studio 2003.net and did a
successful build. >When I run it, a dos window pops up and then closes
(really fast) and the program terminates with an error >code that means
nothing:
> The program '[1900] interactive.exe: Native' has exited with
code -2147483645 (0x80000003).
>Has anyone had better luck with this stuff? I expected to see a gui from
this example but nothing showed up. I'm >not sure what the command line
argument is actually supposed to be when this starts. I've sent a request to
>support@trolltech, but haven't heard back yet.
I had a hard time with this initially. I tried the same as you by starting
with the examples.
I found that the problem was that using QtService is way too simple<g>.
Look at the help that comes with it. Open QtService.html. Click on <more>.
This leads to a simple example that works very well. Just remember that
the class you create is derived (as shown in the help) from
class MyService : public QtService<QApplication>
but QtService<> here is a template and you can pass
it QCoreApplication as well if you don't wnat a GUI.
Just copy this sample, reimplement the shown virtual
functions, put your stuff in start(), create a main as shown
and it should work.
On windows, from the command line you can use
yourservice -i to install, -s to start etc. The -i puts
it in the service manager thing and from there you
can start/stop/restart etc as well.
HTH
--
[ signature omitted ]
Message 3 in thread
Hi,
> But I'm having a heck of a time just understanding the architecture of
> the examples and actually running them. I tried the "interactive"
> service. Imported the .pro file to a Visual Studio 2003.net and did a
> successful build. When I run it, a dos window pops up and then closes
> (really fast) and the program terminates with an error code that means
> nothing:
>
> The program '[1900] interactive.exe: Native' has exited with
> code -2147483645 (0x80000003).
Maybe it's related to this paragraph of the QtServiceBase documentation:
Services are usually launched using the system account,
which requires that all DLLs that the service executable
depends on (i.e. Qt), are located in the same directory
as the service, or in a system path.
--
[ signature omitted ]
Message 4 in thread
"Dimitri" <dimitri@xxxxxxxxxxxxx> wrote in message
news:eqg2sh$m60$1@xxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> > But I'm having a heck of a time just understanding the architecture of
> > the examples and actually running them. I tried the "interactive"
> > service. Imported the .pro file to a Visual Studio 2003.net and did a
> > successful build. When I run it, a dos window pops up and then closes
> > (really fast) and the program terminates with an error code that means
> > nothing:
> >
> > The program '[1900] interactive.exe: Native' has exited with
> > code -2147483645 (0x80000003).
>
> Maybe it's related to this paragraph of the QtServiceBase documentation:
> Services are usually launched using the system account,
> which requires that all DLLs that the service executable
> depends on (i.e. Qt), are located in the same directory
> as the service, or in a system path.
On windows, you usually get an error dialog when an app can't find
its dependancies. IIRC 0x800000003 is usually an assert or breakpoint.
At any rate, if it's Xp or Win2k, the Event viewer
may have more info - right click on my computer then manage.
--
[ signature omitted ]
Message 5 in thread
turns out that it wasn't a dependency. It was merely my lack of
understanding the architecture of the examples. Turns out that the
"interactive" example includes its own installer when run with -i
parameter. So it can be self installed or it can be installed with the
"controller" example. And the gui is a tiny little lable in the upper
left corner of the screen which I never even saw until Volker told me to
run it in debug with the -e option (extremely helpful).
So the examples work now, at least on windows, now I need to make sure
it works on the Macintosh. What fun.
Thanks to everyone for the assistance.
-----Original Message-----
From: Duane Hebert [mailto:spoo@xxxxxxxxx]
Sent: Thursday, February 08, 2007 1:21 PM
To: qt-solutions@xxxxxxxxxxxxx
Subject: Re: QT Service Question
"Dimitri" <dimitri@xxxxxxxxxxxxx> wrote in message
news:eqg2sh$m60$1@xxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> > But I'm having a heck of a time just understanding the architecture
of
> > the examples and actually running them. I tried the "interactive"
> > service. Imported the .pro file to a Visual Studio 2003.net and did
a
> > successful build. When I run it, a dos window pops up and then
closes
> > (really fast) and the program terminates with an error code that
means
> > nothing:
> >
> > The program '[1900] interactive.exe: Native' has exited
with
> > code -2147483645 (0x80000003).
>
> Maybe it's related to this paragraph of the QtServiceBase
documentation:
> Services are usually launched using the system account,
> which requires that all DLLs that the service executable
> depends on (i.e. Qt), are located in the same directory
> as the service, or in a system path.
On windows, you usually get an error dialog when an app can't find
its dependancies. IIRC 0x800000003 is usually an assert or breakpoint.
At any rate, if it's Xp or Win2k, the Event viewer
may have more info - right click on my computer then manage.
--
[ signature omitted ]