5 Replies Latest reply on Jul 25, 2008 3:42 PM by nynymike

    NullPointer refererncing Stateful Session Bean in Quartz Job

    nynymike

      I must be missing something here... but I've been staring at this stacktrace for hours:


      A snippet from my Quartz job looks like this and it runs as scheduled:


      @Name("processor")
      @AutoCreate
      @Scope(ScopeType.APPLICATION)
      public class ScheduleProcessor { 
           @In(required=false, create=true)
           AuthManagerSearchService amSearch;
      .
      .
      .
           private void addPersonFromBulk(Person person) {
                String uid = person.getUid();
                try {
                  logadd.debug("Bulk Add Person: " + uid);
                  if (! amSearch.uidIsUnique(uid)) <--- throws NullPointer
      {
      .
      .
      .
      }
      


      amSearch looks like this. It works fine from the web app...


      @Stateful
      @Name("amSearch")
      @Scope(ScopeType.APPLICATION)
      @AutoCreate
      public class AuthManagerSearchFacade implements AuthManagerSearchService {
      
           public AuthManagerSearchFacade(){};
      
           @Create
           public void init(){
           }
      .
      .
      .
      }
      


      Here is the stacktrace:



      [DEBUG] 24 Jul 02:05:00,087 - Bulk Add Person: foo2
      [ERROR] 24 Jul 02:05:00,088 - Thu Jul 24 02:05:00 EDT 2008: Failed to add bulk user foo2
      [ERROR] 24 Jul 02:05:00,090 - java.lang.NullPointerException
              at edu.nova.itss.grouper.async.ScheduleProcessor.addPersonFromBulk(ScheduleProcessor.java:141)
              at edu.nova.itss.grouper.async.ScheduleProcessor.bulkAddPerson(ScheduleProcessor.java:95)
              at edu.nova.itss.grouper.async.ScheduleProcessor.createQuartzAddTimer(ScheduleProcessor.java:63)
              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:585)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
              at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
              at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:36)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
              at org.jboss.seam.util.Work.workInTransaction(Work.java:41)
              at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:50)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
              at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
              at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
              at edu.nova.itss.grouper.async.ScheduleProcessor_$$_javassist_1.createQuartzAddTimer(ScheduleProcessor_$$_javassist_1.java
      )
              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:585)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
              at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
              at org.jboss.seam.async.AsynchronousInvocation.call(AsynchronousInvocation.java:52)
              at org.jboss.seam.async.Asynchronous.executeInContexts(Asynchronous.java:76)
              at org.jboss.seam.async.Asynchronous.execute(Asynchronous.java:45)
              at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:240)
              at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
              at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
      


      Why can't SEAM successfully inject the amSearch component? I must be missing something simple...


      Thanks in advance.


      - Mike