5 Replies Latest reply on Jun 19, 2009 8:57 AM by Nikolay Elenkov

    Quartz dispatcher is giving some errors while startup

    Manish Prajapati Newbie
      Hi All,

      In my application, i am trying to use quartz-dispatcher for calling asynchronous method at specific interval of time.

      But when server is being loaded ,i am getting following errors:
      Besides this, i have also noticed that my method is called twice while the startup and its getting called at every 2 mins instead of 5 minutes:

      Seam component's asynchronous method:

      public void startAsychronousMethodCalls(){     
              Calendar cal = Calendar.getInstance ();
              cal.set (2010, Calendar.MAY, 10);
              myTest(new Date(),Long.valueOf(60*5000));
              }

              @Asynchronous
              @Transactional
              public QuartzTriggerHandle  myTest(@Expiration Date when, @IntervalDuration Long interval)
              {
      System.out.println("**** Inside the work method ****");
      }

      Following is exception stack trace which i get while context is being loaded:

      14:15:30,000 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

              test-ear/TimerServiceDispatcher/local - EJB3.x Default Local Business Interface
              test-ear/TimerServiceDispatcher/local-org.jboss.seam.async.LocalTimerServiceDispatcher - EJB3.x Local Business Interface

      14:15:30,281 ERROR [TimerImpl] Error invoking ejbTimeout
      org.jboss.aop.DispatcherConnectException: EJB container is not completely started, or is stopped.
              at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:60)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.stateless.StatelessContainer.callTimeout(StatelessContainer.java:304)
              at org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run(TimerImpl.java:561)
              at java.util.TimerThread.mainLoop(Timer.java:512)
              at java.util.TimerThread.run(Timer.java:462)
      14:15:30,500 INFO  [SessionSpecContainer] Starting jboss.j2ee:ear=test-ear.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3
      14:15:30,500 INFO  [EJBContainer] STARTED EJB: org.jboss.seam.transaction.EjbSynchronizations ejbName: EjbSynchronizations
      14:15:30,828 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

              test-ear/EjbSynchronizations/local - EJB3.x Default Local Business Interface
              test-ear/EjbSynchronizations/local-org.jboss.seam.transaction.LocalEjbSynchronizations - EJB3.x Local Business Interface

      14:15:30,921 ERROR [TimerImpl] Error invoking ejbTimeout
      javax.ejb.EJBException: java.lang.RuntimeException: java.lang.IllegalStateException: Attempted to invoke a Seam component outside an initialized application
              at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:77)
              at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
              at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:75)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:65)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.ejb3.stateless.StatelessContainer.callTimeout(StatelessContainer.java:304)
              at org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run(TimerImpl.java:561)
              at java.util.TimerThread.mainLoop(Timer.java:512)
              at java.util.TimerThread.run(Timer.java:462)
      Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Attempted to invoke a Seam component outside an initialized application
              at org.jboss.ejb3.EJBContainer.invokeCallback(EJBContainer.java:1113)
              at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:1123)
              at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:1134)
              at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:93)
              at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:56)
              at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:51)
              at org.jboss.ejb3.pool.ThreadlocalPool.create(ThreadlocalPool.java:53)
              at org.jboss.ejb3.pool.ThreadlocalPool.get(ThreadlocalPool.java:93)
              at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
              at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
              ... 20 more
      Caused by: java.lang.IllegalStateException: Attempted to invoke a Seam component outside an initialized application
              at org.jboss.seam.contexts.Lifecycle.getApplication(Lifecycle.java:36)
              at org.jboss.seam.contexts.Lifecycle.setupApplication(Lifecycle.java:129)
              at org.jboss.seam.Seam.componentForName(Seam.java:298)
              at org.jboss.seam.intercept.SessionBeanInterceptor.postConstruct(SessionBeanInterceptor.java:102)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.ejb3.interceptors.aop.LifecycleCallbackInterceptorMethodInterceptor.invoke(LifecycleCallbackInterceptorMethodInterceptor.java:80)
              at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:79)
              at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)
              at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_26697030.invoke(InvocationContextInterceptor_z_setup_26697030.java)
              at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:79)
              at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
              at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:79)
              at org.jboss.ejb3.EJBContainer.invokeCallback(EJBContainer.java:1109)
              ... 30 more

      Thanks in advance.

      If any one need more details, i can provide.

      Regards,
      Manish
        • 1. Re: Quartz dispatcher is giving some errors while startup
          Nikolay Elenkov Master

          It looks like you have the EJB timer service configured, not Quartz. Show your components.xml.

          • 2. Re: Quartz dispatcher is giving some errors while startup
            Manish Prajapati Newbie
            Thanks Nikoly,

            Following is my components.xml

            <?xml version="1.0" encoding="UTF-8"?>
            <components xmlns="http://jboss.com/products/seam/components"
                        xmlns:core="http://jboss.com/products/seam/core"
                        xmlns:drools="http://jboss.com/products/seam/drools"
                        xmlns:security="http://jboss.com/products/seam/security"
                        xmlns:mail="http://jboss.com/products/seam/mail"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xmlns:persistence="http://jboss.com/products/seam/persistence"
                        xmlns:framework="http://jboss.com/products/seam/framework"
                        xmlns:web="http://jboss.com/products/seam/web"
                        xmlns:async="http://jboss.com/products/seam/async"
                        xmlns:bpm="http://jboss.com/products/seam/bpm"
                        xmlns:transaction="http://jboss.com/products/seam/transaction"
                        xsi:schemaLocation=
                            "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.1.xsd
                             http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.1.xsd
                             http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
                             http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.1.xsd
                             http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd
                             http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.xsd
                             http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.xsd
                             http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.1.xsd
                             http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.1.xsd
                             http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.1.xsd
                                 http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.1.xsd">

               <core:init debug="true" jndi-pattern="@jndiPattern@"/>
                
               <core:manager concurrent-request-timeout="500"
                             conversation-timeout="120000"
                             conversation-id-parameter="cid" />
                             <!-- conversation-is-long-running-parameter="clr"/> -->

                <!-- <persistence:filter name="deletedFilter" >
                  <persistence:name>deletedFilter</persistence:name>
                  <persistence:parameters>
                    <key>deleted</key>
                    <value>false</value>
                  </persistence:parameters>
                </persistence:filter> -->

                <persistence:filter name="clientFilter" enabled="#{!userContext.client.template}">
                  <persistence:name>clientFilter</persistence:name>
                  <persistence:parameters>
                    <key>clientId</key>
                    <value>#{userContext.client.id}</value>
                  </persistence:parameters>
                </persistence:filter>
               
               <persistence:managed-persistence-context name="entityManager"
                                          auto-create="true"
                           persistence-unit-jndi-name="java:/testEntityManagerFactory">
                           <persistence:filters>
                           <value>#{clientFilter}</value>
                           <!-- <value>#{deletedFilter}</value> -->
                           </persistence:filters>
               </persistence:managed-persistence-context>

               <persistence:managed-persistence-context name="asyncEntityManager"
                                          auto-create="true"
                           persistence-unit-jndi-name="java:/testEntityManagerFactory" >
               </persistence:managed-persistence-context>

                     <!-- Install the QuartzDispatcher -->
            <async:quartz-dispatcher/>

                 
               <!--  <core:ejb installed="@embeddedEjb@"/>-->
              
               <transaction:ejb-transaction />
              
               <!-- <drools:rule-base name="securityRules">
                   <drools:rule-files>
                       <value>/security.drl</value>
                   </drools:rule-files>
               </drools:rule-base> -->


               <drools:rule-base name="testRuleBase" class="com.test.seam.external.testRuleBase" scope="application" rule-files="/META-INF/CreditReportEvaluationRules.xls">
               </drools:rule-base>
               <drools:managed-working-memory name="creditReportWorkingMem"   rule-base="#{testRuleBase}"  />

               <bpm:jbpm><bpm:pageflow-definitions><value>/test/apprequest-pageflow.jpdl.xml</value></bpm:pageflow-definitions></bpm:jbpm>
              
               <!-- <security:identity authenticate-method="#{authenticator.authenticate}"></security:identity> -->

               <security:jpa-identity-store name="customerIdentityStore"
                                            class="com.test.seam.infrastructure.auth.testIdentityStore" 
                                            user-class="com.test.seam.entity.Customer"
                                            role-class="com.test.seam.entity.Role">
               </security:jpa-identity-store>
              
               <security:jpa-identity-store name="officerIdentityStore"
                                            class="com.test.seam.infrastructure.auth.testIdentityStore" 
                                            user-class="com.test.seam.entity.Officer"
                                            role-class="com.test.seam.entity.Role">
               </security:jpa-identity-store>
               <security:identity-manager class="com.test.seam.infrastructure.auth.testIdentityManager"></security:identity-manager>

                <security:jpa-permission-store ></security:jpa-permission-store>
               <!--

               <security:identity authenticate-method="#{authenticator.authenticate}"
                                       security-rules="#{securityRules}"/>
              
               <event type="org.jboss.seam.notLoggedIn">
                   <action expression="#{redirect.captureCurrentView}"/>
               </event>
               <event type="org.jboss.seam.postAuthenticate">
                   <action expression="#{redirect.returnToCapturedView}"/>
               </event>
              
               -->
              
               <mail:mail-session host="localhost" port="2525" username="test" password="test" />
                   
               <!-- For use with jBPM pageflow or process management -->
               <!-- 
               <core:jbpm>
                  <core:process-definitions></core:process-definitions>
                  <core:pageflow-definitions></core:pageflow-definitions>
               </core:jbpm>
               -->

                 
                 <factory name="serverBasePath" auto-create="true"
                      value="#{facesContext.externalContext.request.scheme}://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}#{facesContext.externalContext.request.contextPath}/" />

                 <event type="org.jboss.seam.postInitialization">
                    <action execute="#{initializer.init}" />
                    <action execute="#{demoSetup.init}" />
                    <action execute="#{clientRegistry.init}" />
                 </event>
            </components>
            • 3. Re: Quartz dispatcher is giving some errors while startup
              Nikolay Elenkov Master

              You seem to have the Quartz dispatcher configured correctly. The errors you are getting are from the
              EJB timer service though. Were you using <async:timer-service-dispatcher/> before you switched to 
              Quartz? If so, you may have some leftover jobs, that are causing the errors (timers are persistent).

              • 4. Re: Quartz dispatcher is giving some errors while startup
                Manish Prajapati Newbie

                Thanks a lot again Nikolay for your appreciable idea.


                Can you give me more hint for this because i have also posted one more issue which is also related with this because when i change the name of asynchronous method its giving me error such as NoSuchMethodException because it refers to older method name not new one.


                Many time i removed existing deployed folder and deployed again but not found any solution to this problem.


                So tell me how i can cope with this issue, how i can detect where it has persisted the data.


                I searched in data folder of jboss and also tried to search the older method name but i didnt find anything which can convert my suspect that data are persisted some where into reality.


                Kindly,help me to overcome from this issue at earliest because i have already spent 2 days and today i am also going to work on the same.


                If any information is required to know more about configuration or anything please let me know.


                Thanks a lot in advance.


                Regards,
                Manish

                • 5. Re: Quartz dispatcher is giving some errors while startup
                  Nikolay Elenkov Master

                  To clear all EJB timers do something like this in an EJB:


                  @Resource javax.ejb.TimerService timerService;
                  
                  public void clearTimers() {
                    for (Object t : timerService.getTimers()) {
                     javax.ejb.Timer timer = (Timer)t;
                     timer.cancel()
                    }
                  }