cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Pötz <>
Subject Re: ServletSource outside of pipeline
Date Mon, 04 Aug 2008 12:24:57 GMT
Reinhard Pötz wrote:
> Robin Wyles wrote:
>> 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(

>>     at 
>> org.apache.cocoon.servletservice.CallStackHelper.getCurrentServletContext(

>>     at 
>> org.apache.cocoon.servletservice.components.ServletSource.createServletConnection(

> <snip/>
>> 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?
> IMO no. From a quick glance at the code I think it needs to be more 
> defensive in terms of catching NPEs. In the case that there is no 
> existing call frame, null should be returned. Grzegorz, what do you think?

I've just committed a fix for this (revision 682356) so that *absolute* 
servlet URLs *should* work. (It can never work for self-referenced 
servlet URLs or relative servlet URLs without an existing servlet 
service request.)

Unfortunately I don't have a test case and currently no idea how I can 
provide a simple environment. This means that I'm not sure if there are 
other locations that have a problem if there is no existing servlet 
service requuest.

Any ideas for a test environment?

Reinhard Pötz                           Managing Director, {Indoqa} GmbH

Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member        

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message