Quartz Service starts then stops

774 views
Skip to first unread message

bizcad

unread,
Sep 12, 2010, 1:51:04 PM9/12/10
to Quartz.NET
I managed to get the Quartz Service to compile. I install the service
as manual. I then try to start the service in the Service Control
Manager and get a dialog box with the following message. The Quartz
Server service on Local Computer started and then stopped. Some
services stop automatically if they are not in use by other services
or programs.

Any idea why this automatic stopping might occur? The only thing I
can think of is that the Program class Main calls Run and then exits.

static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[] { new QuartzService() };
ServiceBase.Run(ServicesToRun);
}

The event log look pretty good. Here are the events recorded in the
Application log.

The following preamble shows up in every event, but I omit them for
brevity...
2010-09-12 10:44:47,880 [3292] INFO
Common.Logging.Factory.AbstractLogger.Info(C:\Users\Nick\Documents
\Visual Studio 2010\Projects\QuartzServer\Common.Logging-2.0.0\modules
\Common.Logging\src\Common\Common.Logging\Logging\Factory
\AbstractLogger.cs:473)

Events:
- Registering datasource 'QuartzDataSet' with db provider:
'Quartz.Impl.AdoJobStore.Common.DbProvider'

Using custom data access locking (synchronization):
Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore

- Registering remoting channel of type
'System.Runtime.Remoting.Channels.Tcp.TcpChannel' to port (555)

- Remoting channel registered successfully

- Successfully marhalled remotable scheduler under name
'ServerScheduler'

- Initialized Scheduler Signaller of type:
Quartz.Core.SchedulerSignalerImpl

-Quartz Scheduler v.1.0.3.4 created.

- JobStoreTX initialized.

- Quartz scheduler 'ServerScheduler' initialized
and finally...
- Quartz scheduler version: 1.0.3.4

Gizza

unread,
Sep 12, 2010, 2:32:57 PM9/12/10
to Quartz.NET
Hi

couple of things to check...

Is everything copied to the bin folder of your Windows Service ?

e.g. Common.Logging.dll, quartz config files etc.

Once you are sure logging is setup correctly, I would put a lot more
debug statements in to see how it progresses.

Do you actually get an error ?

bizcad

unread,
Sep 13, 2010, 2:22:42 PM9/13/10
to Quartz.NET
@Gizza,

I do not get an error. When I start the service in the Service
Manager, It says the service started and then stopped.

I know how to attach to the service process in VS2010 once the service
is started. Then I can debug it in the normal way. My problem is
that the service does not stay started, so i cannot tell if the
scheduler is running.

When I created my project, I opened the Quartz.Server.Service.csproj.
I then added the source code for:
Quartz.csproj
Quartz.Server.Core.csproj
CommonLogging.csproj
CommonLoggin4Net.csproj
Log4Net.csproj

When I was compiling the console version of Quartz, I downloaded the
source code for all those projects, upgraded them to VS2010 and .Net
4, and got them to compile. I had a number of problems with not
finding the assemblies because the Quartz Server and the Quartz Client
compiled code needed to be in the same folder so that they would all
load. But in the end, the console app is able to schedule a job and
it runs.

I opened the Quartz.Server.Service.csproj and saved it as a Solution.
I then added the csproj files as for the console app. I had to
replace some of the references so that they referred to the projects
rather than to the dlls. In the end they all compiled. I can start
in debugging, but of course I get the message that I cannot debug a
service directly. I can stop in Program Main and subsequently in the
QuartzService : ServerBase constructor.

The call to QuartzServerFactory.CreateServer returns a server object.
In the Watch window, I can see that the server object is a
Quartz.Server.Core.QuartzServer type.

Inside the server, I can see the logger, a
Common.Logging.Log4Net.Log4NetLogger type, has IsDebugEnabled = false,
and IsTraceEnabled = false and IsInfoEnabled = true. I can verify that
the Info messages are being put out to the EventLog as I discussed in
my original post, so that makes sense.

I can also see that after the Initialize method is called, the
scheduler object, a Quartz.Impl.StdScheduler type, is
InStandbyMode=true, IsShutdown = false and IsStarted = false.

It is when I step through the ServiceBase.Run(ServiceToRun); in
Program.Main that I get the message box that I cannot start the
service from the command line or debugger.

The app.config has the level set to INFO I will try changing it to
DEBUG to see if I get more info.

Nick



Blake Smith

unread,
Sep 13, 2010, 2:31:50 PM9/13/10
to quar...@googlegroups.com
I ran into a similar issue where my service would start and then stop immediately.  It turned out that my service was throwing an exception and stopping.  Try putting a try/catch around your Main() and log any exceptions to a file so you can see if anything is going wrong.




--
You received this message because you are subscribed to the Google Groups "Quartz.NET" group.
To post to this group, send email to quar...@googlegroups.com.
To unsubscribe from this group, send email to quartznet+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/quartznet?hl=en.


Stephen Tunney

unread,
Sep 13, 2010, 2:37:14 PM9/13/10
to quar...@googlegroups.com

This is almost always a permissions or file not found issue.  Is your log4net config in a separate file (not in your .exe.config file that is)?

Mark Jones

unread,
Sep 13, 2010, 2:37:09 PM9/13/10
to quar...@googlegroups.com

In addition to this, make sure that if your hosting an EndPoint (via WCF), that something else, like the WCF Test Service isn’t loading up before you start the service. (It appears in the system tray).

 

Mark Jones

SharePoint Solutions Architect - Collaboris Ltd

www.collaboris.co.uk

 

This message is intended only for the use of the person(s) ("the intended recipient(s)") to whom it is addressed. It may contain information which is privileged and confidential within the meaning of applicable law. If you are not the intended recipient, please contact the sender as soon as possible. The views expressed in this communication may not necessarily be the views held by The Company.

 

From: quar...@googlegroups.com [mailto:quar...@googlegroups.com] On Behalf Of Blake Smith
Sent: 13 September 2010 19:32
To: quar...@googlegroups.com
Subject: Re: [quartznet:2033] Re: Quartz Service starts then stops

 

I ran into a similar issue where my service would start and then stop immediately.  It turned out that my service was throwing an exception and stopping.  Try putting a try/catch around your Main() and log any exceptions to a file so you can see if anything is going wrong.

bizcad

unread,
Sep 13, 2010, 2:49:57 PM9/13/10
to Quartz.NET
I got it!

By changing the level to DEBUG in the app.config, I got more info in
the Event log.

I get the following messages:
Starting Service
Lock TRIGGER_ACCESS is desired by: (with no by specified)
lock TRIGGER_ACCESS being obtained
Lock TRIGGER_ACCESS was not obtained by: (likewise with no by
specified)
Disposing Service
Service Disposed

So I checked the database. Sure enough the QRTZ_LOCKS table was
empty. By inserting the lock types the service started.

Thanks for your help.

Nick
Reply all
Reply to author
Forward
0 new messages