0

I have created the quartz scheduler but it is running the method twice.Some of the links suggests that Application context is loading twice. I am unable to find out in web.xml`

      <?xml version="1.0" encoding="UTF-8"?>
        <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee            http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
     id="WebApp_ID"
     version="2.5">

      <display-name>TimeSheetManagementSystems</display-name>
       <filter>
         <filter-name>LoginFilter</filter-name>
         <filter-class>com.agranee.timesheet.filter.LoginFilter</filter-class>
      </filter>
     <filter-mapping>
      <filter-name>LoginFilter</filter-name>
       <url-pattern>/pages/*</url-pattern>
      </filter-mapping>



      <!-- Spring Context Configuration' s Path definition -->
      <context-param>
        <param-name>contextConfigLocation</param-name>
         <param-value>
           /WEB-INF/applicationContext.xml
         </param-value>
      </context-param>



       <listener>
          <listener-class>
             org.springframework.web.context.ContextLoaderListener
          </listener-class>
       </listener>
       <listener>
       <listener-class>
           org.springframework.web.context.request.RequestContextListener
        </listener-class>
  </listener>



     <context-param>
       <param-name>javax.faces.PROJECT_STAGE</param-name>
       <param-value>Development</param-value>
     </context-param>



      <welcome-file-list>
         <welcome-file>login.xhtml</welcome-file>
      </welcome-file-list>


       <servlet>
          <servlet-name>Faces Servlet</servlet-name>
          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
          <load-on-startup>1</load-on-startup>
      </servlet>


       <servlet-mapping>
           <servlet-name>Faces Servlet</servlet-name>
           <url-pattern>*.xhtml</url-pattern>
      </servlet-mapping>
       <servlet-mapping>
         <servlet-name>Faces Servlet</servlet-name>
         <url-pattern>*.faces</url-pattern>
     </servlet-mapping>


        <filter>
            <filter-name>PrimeFaces FileUpload Filter</filter-name>
             <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
            <init-param>
              <param-name>thresholdSize</param-name>
              <param-value>51200</param-value>
           </init-param>
     </filter>


        <filter-mapping>
            <filter-name>PrimeFaces FileUpload Filter</filter-name>
            <servlet-name>Faces Servlet</servlet-name>
        </filter-mapping>


     </web-app>`

Any help is greatly appreciated.

Swarnim Prabhat
  • 89
  • 1
  • 2
  • 12
  • Can you check the answers [here](http://stackoverflow.com/questions/11957673/scheduled-processes-running-twice-simultaneously-in-openbravo-using-quartz) and [here](http://stackoverflow.com/questions/7223108/quartz-job-runs-twice-when-deployed-on-tomcat-6-ubuntu-10-04lts) – Wundwin Born Mar 24 '14 at 09:09
  • You can check Spring debug logs to figure out if spring context config is initialized twice. – pomkine Mar 24 '14 at 09:11

1 Answers1

0

you can check here Too frequent load of Quartz Scheduler in a Spring application

Probably, somewhere in your code, you load your context twice. Then, each time, scheduler will be re-run.

Search in your Java classes string "web.xml" and check, how many times you load this file.

Community
  • 1
  • 1
ruhungry
  • 4,506
  • 20
  • 54
  • 98