Main Tutorials

Quartz : org.quartz.SchedulerConfigException: Thread count must be > 0

Working with Quartz 2, when running the project, hits following error message?


	org.quartz.SchedulerConfigException: Thread count must be > 0
	at org.quartz.simpl.SimpleThreadPool.initialize(SimpleThreadPool.java:245)
	at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1255)
	at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1484)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:680)

Solution

You have defined a “quartz.properties” file, and override the default Quartz’s thread count value.

To fix it, you can :

  1. Delete your “quartz.properties”, normally this file is need for advance configuration only. Normally, simple project don’t need this.
  2. Defined a org.quartz.threadPool.threadCount value properly.

File : quartz.properties – Working sample.


org.quartz.scheduler.instanceName = MyScheduler
org.quartz.threadPool.threadCount = 3
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
org.quartz.plugin.jobInitializer.class =org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin 
org.quartz.plugin.jobInitializer.fileNames = quartz-config.xml 
org.quartz.plugin.jobInitializer.failOnFileNotFound = true

References

  1. Quartz configuration reference
  2. JSF 2 + Quartz example

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments