2 Replies Latest reply on Nov 11, 2011 4:33 AM by Thiagu Mariappan

    Exeception thrown whilst executing asynchronous call

    Thiagu Mariappan Novice

      Hi,


      In my project ear have two war files.The war file one has seam.quartz.properties file from WEB-INF/classes folder.This propertie file has following configuration.


      org.quartz.scheduler.instanceName = Sched1
      org.quartz.scheduler.instanceId = 1
      org.quartz.scheduler.rmi.export = false
      org.quartz.scheduler.rmi.proxy = false
      
      org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
      org.quartz.threadPool.threadCount = 3
      
      org.quartz.jobStore.misfireThreshold 60000
      org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
      


      The war file one has following line in the components.xml from WEB-INF folder.


      <async:quartz-dispatcher/>
      


      The war file one has following two seam components classes from WEB-INF/classes folder.


      @Name("controller")
      @Scope(APPLICATION)
      @AutoCreate
      @Startup
      public class ScheduleController {
      
          @In
          ScheduleProcessor processor;
      
          private QuartzTriggerHandle quartzTestTriggerHandle;
          private static String CRON_INTERVAL = "0 * * * * ?";
      
          @Create
          public void scheduleTimer() {
               quartzTestTriggerHandle =
                      processor.initProcess(new Date(), CRON_INTERVAL);
           }    
          
      }
      
      


      and


      @Name("processor")
      @AutoCreate
      public class ScheduleProcessor {
      
      
          @Asynchronous
          @Transactional
          public QuartzTriggerHandle initProcess(
                      @Expiration Date when, @IntervalCron String interval) {
               System.out.println("___________________"+new Date());
               return null;
          }
      }
      
      


      The ear/lib folder has quartz.jar file.When I deploy my ear project I am getting the null pointer exception after every minute.


      java.lang.NullPointerException
           at org.jboss.seam.async.AsynchronousInvocation$1.process(AsynchronousInvocation.java:55)
           at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:80)
           at org.jboss.seam.async.AsynchronousInvocation.execute(AsynchronousInvocation.java:44)
           at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:243)
           at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
           at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)  
      
      


      this exception because of Component.getInstance(processor) returns null value.
      This line is from AsynchronousInvocation.java:50.


      any one help me how to resolve this issue..


        • 1. Re: Exeception thrown whilst executing asynchronous call
          Thiagu Mariappan Novice

          Is it possible to add more than one war archive in an ear application?


          When I deploy the two wars in an ear the seam composes from the wars are loaded twice.
          So while loading the seam components at second time, the seam context of first war unit is getting override.


          If I have my quartz scheduler in my first war deployment unit, I am getting the following exception.Because the seam context of the first war is override when the seam composes loaded from the second wars. So I am getting the null while executing the following line


          Component.getInstance(“processor”);
          


          This line is from AsynchronousInvocation.java:50.


          11:31:00,015 ERROR [AsynchronousExceptionHandler] Exeception thrown whilst executing asynchronous call
          java.lang.NullPointerException
               at org.jboss.seam.async.AsynchronousInvocation$1.process(AsynchronousInvocation.java:55)
               at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:80)
               at org.jboss.seam.async.AsynchronousInvocation.execute(AsynchronousInvocation.java:44)
               at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:243)
               at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
               at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
          



          So I try to load my war unit which has seam scheduler at last, by alter the “application.xml” entry order. But it is not workout. Because the jboss load the file by alphabetic order. So I rename my war which has quartz scheduler accordingly. Now this exception is gone. The quartz schedule is working fine. but this solution is just workarround. it is not good solution.


          is there any why to load the seam componets at onece, even if i have more than one war?
          is there any other solution to resolve this issue.

          • 2. Re: Exeception thrown whilst executing asynchronous call
            Thiagu Mariappan Novice

            I think this is known issue in seam.


            My Link


            Is there any jira entry for this issue?
            If this issue is resolved please tell me which seam version I need to use.
            Or else please suggest me the workaround.
            I am using seam 2.2.2.Final.