You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 26 Members of 4187 |
| Forum: Seam Users |
24. Jul 2008, 14:15 CET | Link |
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
One of my partners figured this out... make amSearch SESSION scoped....
Actually, now I'm getting this error again with amSearch scoped as SESSION...
This problem is intermittant. Going on two days of trying to troubleshoot this... sometimes it works. And then I'll try it again, and the same line throws a NullPointer... any ideas welcome.
Just guessing but is there some conflict in using both required=false and create=true?
Can you set the log level to highest so you can see what decisions the framework makes before the exception occurs?
If a man speaks in the forest and there is no woman around to hear him, is he still wrong?
I looked at the server.log file, and the EJB seemed to be getting injected properly... It looks like I resolved this by taking out the @Scope completely.