0

I developed an application using vaadin and quartz scheduler. I have this code :

final ServletContext servletContext = VaadinServlet.getCurrent().getServletContext();

StdSchedulerFactory stdSchedulerFactory = (StdSchedulerFactory) servletContext
            .getAttribute(QuartzInitializerListener.QUARTZ_FACTORY_KEY);
final Scheduler scheduler = stdSchedulerFactory.getScheduler();

So I notice that sometimes after the server reboot I have a java.lang.NullPointerException on this line stdSchedulerFactory.getScheduler()

Can you explain me what happen?

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
Aniss
  • 39
  • 1
  • 1
  • 8

1 Answers1

0

The problem is in the way you initialize the scheduler.
I think someone had a similar problem (different error, but same usage).

//Create & start the scheduler.
        StdSchedulerFactory factory = new StdSchedulerFactory();
        factory.initialize(servletContext.getResourceAsStream("/WEB-INF/my_quartz.properties"));
        scheduler = factory.getScheduler();

Please take a look here for more details.

Community
  • 1
  • 1
Asaf Savich
  • 623
  • 1
  • 9
  • 29