Hi,

I have a component in my app that uses SourceResolver to create a ServletSource. When I call this component from within a pipeline, e.g. from flow or from a sitemap component all works well. However, when I call this method from a cron job I get the following NPE:

java.lang.NullPointerException
at org.apache.cocoon.callstack.environment.CallFrameHelper.getContext (CallFrameHelper.java:75) at org.apache.cocoon.servletservice.CallStackHelper.getCurrentServletContex t(CallStackHelper.java:112) at org.apache.cocoon.servletservice.components.ServletSource.createServletC onnection(ServletSource.java:125) at org.apache.cocoon.servletservice.components.ServletSource.<init> (ServletSource.java:72) at org.apache.cocoon.servletservice.components.ServletSourceFactory.getSour ce(ServletSourceFactory.java:74) at org.apache.cocoon.components.source.CocoonSourceResolver.resolveURI (CocoonSourceResolver.java:153) at org.apache.cocoon.components.source.CocoonSourceResolver.resolveURI (CocoonSourceResolver.java:183) at org.apache.cocoon.rest.util.DOMPoster.postToPipeline (DOMPoster.java:57) at com.jac.james.publisher.Publisher.uploadEntryFiles(Publisher.java: 224)
        at com.jac.james.publisher.Publisher.doUploads(Publisher.java:198)
        at sun.reflect.GeneratedMethodAccessor148.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java: 276) at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean $MethodInvokingJob.executeInternal (MethodInvokingJobDetailFactoryBean.java:260) at org.springframework.scheduling.quartz.QuartzJobBean.execute (QuartzJobBean.java:86)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:529)


The root problem seems to be that the CallStack is empty and so the the current ServletContext cannot be obtained using CallStackHelper.getCurrentServletContext().

Am I doing anything wrong?

Thanks,

Robin

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to