java - i cant create a Scheduler instance in spring mvc using quartz -
Hello I am using quartz in the Spring MVC project and I want to make a scheduler instance but I have the following error when I try to do this:
Scheduler scheduler = new stdciularfisher (). GetScheduler ();
Error: The default constructor can not handle exception type scheduler expansion by the built in super constructor. It's important to define a clear constructor
this is my maven suspension
& Lt; Version & gt; 3.1.2.RELEASE & lt; / Edition & gt; & Lt; / Dependencies & gt; & Lt ;! - Spring + quartz transaction requirement - & gt; & Lt; Dependency & gt; & Lt; Group & gt; Org.springframework & lt; / Group & gt; & Lt; ArtifactId & gt; Spring-tx & lt; / ArtifactId> & Lt; Version & gt; 3.1.2.RELEASE & lt; / Edition & gt; & Lt; / Dependencies & gt; & Lt ;! - Quartz Framework - & gt; & Lt; Dependency & gt; & Lt; Group & gt; Org.quartz-scheduler & lt; / Group & gt; & Lt; ArtifactId & gt; Quartz & lt; / ArtifactId> & Lt; Version & gt; 2.2.1 & lt; / Edition & gt; & Lt; / Dependencies & gt;
And this is the class where I try to create a Scheduler object
import java.util.Locale; Import org.quartz.job; Import org.quartz.JobExecutionContext; Import org.quartz.Scheduler; Import org.quartz.impl.StdSchedulerFactory; Public class prints the printing job {periodic scheduler = new stady shielder ()). GetScheduler (); Public Zero Execution (JobExecutionContext ctx) {System.out.printf (New locale ("es", "MX"), "% tc one job is printed ...% n", new java.util.Date ()) ; }}
A check throws an exception, which must be handled in a code block Block
Usually you will not include the scheduler
code within Job
. I create a separate scheduler management class where to control the scheduling functionality A different method can be used.
Public Segment JobScheduler {Public Static Zero Main (string [] Args) {Try / Specify Job Details. JobDetail Job = JobBuilder.newJob (PrintSomething.class) .withIdentity ("mide") .build (); ... // Create Triggers / Scheduling schedulerfaturefafecture = new stadilatorfighter (); Scheduler scheduler = schfactory.getScheduler (); Scheduler.start (); Scheduler.scheduleJob (Job, some triggers); } Hold (SchedulerException E) {// Handle exception here E. Printstack (); }}}
Comments
Post a Comment