PDF generation from scheduled task fails

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

PDF generation from scheduled task fails

Jasper Linthorst
Hi All,
I've noticed that when I use the 'xhtml-to-pdf' processor from a pipeline that's run through the scheduler it fails at the point where it tries to resolve an external resource (like my css).

It generates a NullPointerException at 
org.orbeon.oxf.processor.pdf.XHTMLToPDFProcessor$1.resolveURI(XHTMLToPDFProcessor.java:77)

Whenever I run the pipeline through an http request (using the pfc) all works fine.

The problem probably has to do with the lack of a ExternalContext/Request object when running a pipeline through the scheduler. Could anyone let me know if there's a workaround to this?

Thanks in advance!

Jasper


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: PDF generation from scheduled task fails

Erik Bruchez
Administrator
Jasper,

We need to fix this at some point.

As a not-so-nice workaround, you could have your scheduler perform an HTTP request, and implement the PDF generation from that service.

-Erik

On Mon, May 2, 2011 at 6:14 AM, Jasper Linthorst <[hidden email]> wrote:
Hi All,
I've noticed that when I use the 'xhtml-to-pdf' processor from a pipeline that's run through the scheduler it fails at the point where it tries to resolve an external resource (like my css).

It generates a NullPointerException at 
org.orbeon.oxf.processor.pdf.XHTMLToPDFProcessor$1.resolveURI(XHTMLToPDFProcessor.java:77)

Whenever I run the pipeline through an http request (using the pfc) all works fine.

The problem probably has to do with the lack of a ExternalContext/Request object when running a pipeline through the scheduler. Could anyone let me know if there's a workaround to this?

Thanks in advance!

Jasper


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: PDF generation from scheduled task fails

Jasper Linthorst
Hi Erik,
Thanks for the feedback. Will go with the suggested workaround.

Jasper

On Tue, May 3, 2011 at 6:16 AM, Erik Bruchez <[hidden email]> wrote:
Jasper,

We need to fix this at some point.

As a not-so-nice workaround, you could have your scheduler perform an HTTP request, and implement the PDF generation from that service.

-Erik

On Mon, May 2, 2011 at 6:14 AM, Jasper Linthorst <[hidden email]> wrote:
Hi All,
I've noticed that when I use the 'xhtml-to-pdf' processor from a pipeline that's run through the scheduler it fails at the point where it tries to resolve an external resource (like my css).

It generates a NullPointerException at 
org.orbeon.oxf.processor.pdf.XHTMLToPDFProcessor$1.resolveURI(XHTMLToPDFProcessor.java:77)

Whenever I run the pipeline through an http request (using the pfc) all works fine.

The problem probably has to do with the lack of a ExternalContext/Request object when running a pipeline through the scheduler. Could anyone let me know if there's a workaround to this?

Thanks in advance!

Jasper


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: PDF generation from scheduled task fails

Jasper Linthorst
Ok, eventually I fixed things in a different matter, because it turned out that the xforms submission processor (which I tried to use to make the http request) also uses the ExternalContext (so I ended up with a similar error). What I've done now is I've created a custom 'xhtml-to-pdf' processor based on Orbeon's code and made a minor change so that it doesn't retrieve the ExternalContext through the PipelineContext, but instead create an instance of SimpleExternalContext and use that for the rewriting... All seems to work just fine.

@Erik, could you let me know if this could be a probable solution?



On Tue, May 3, 2011 at 9:18 AM, Jasper Linthorst <[hidden email]> wrote:
Hi Erik,
Thanks for the feedback. Will go with the suggested workaround.

Jasper


On Tue, May 3, 2011 at 6:16 AM, Erik Bruchez <[hidden email]> wrote:
Jasper,

We need to fix this at some point.

As a not-so-nice workaround, you could have your scheduler perform an HTTP request, and implement the PDF generation from that service.

-Erik

On Mon, May 2, 2011 at 6:14 AM, Jasper Linthorst <[hidden email]> wrote:
Hi All,
I've noticed that when I use the 'xhtml-to-pdf' processor from a pipeline that's run through the scheduler it fails at the point where it tries to resolve an external resource (like my css).

It generates a NullPointerException at 
org.orbeon.oxf.processor.pdf.XHTMLToPDFProcessor$1.resolveURI(XHTMLToPDFProcessor.java:77)

Whenever I run the pipeline through an http request (using the pfc) all works fine.

The problem probably has to do with the lack of a ExternalContext/Request object when running a pipeline through the scheduler. Could anyone let me know if there's a workaround to this?

Thanks in advance!

Jasper


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: PDF generation from scheduled task fails

Erik Bruchez
Administrator
Jasper,

That is a possible one. I think it would still be better if an external context was available and handled properly. Without spending a bit more time looking into it I am not completely sure though!

-Erik

On Tue, May 3, 2011 at 4:09 AM, Jasper Linthorst <[hidden email]> wrote:
Ok, eventually I fixed things in a different matter, because it turned out that the xforms submission processor (which I tried to use to make the http request) also uses the ExternalContext (so I ended up with a similar error). What I've done now is I've created a custom 'xhtml-to-pdf' processor based on Orbeon's code and made a minor change so that it doesn't retrieve the ExternalContext through the PipelineContext, but instead create an instance of SimpleExternalContext and use that for the rewriting... All seems to work just fine.

@Erik, could you let me know if this could be a probable solution?



On Tue, May 3, 2011 at 9:18 AM, Jasper Linthorst <[hidden email]> wrote:
Hi Erik,
Thanks for the feedback. Will go with the suggested workaround.

Jasper


On Tue, May 3, 2011 at 6:16 AM, Erik Bruchez <[hidden email]> wrote:
Jasper,

We need to fix this at some point.

As a not-so-nice workaround, you could have your scheduler perform an HTTP request, and implement the PDF generation from that service.

-Erik

On Mon, May 2, 2011 at 6:14 AM, Jasper Linthorst <[hidden email]> wrote:
Hi All,
I've noticed that when I use the 'xhtml-to-pdf' processor from a pipeline that's run through the scheduler it fails at the point where it tries to resolve an external resource (like my css).

It generates a NullPointerException at 
org.orbeon.oxf.processor.pdf.XHTMLToPDFProcessor$1.resolveURI(XHTMLToPDFProcessor.java:77)

Whenever I run the pipeline through an http request (using the pfc) all works fine.

The problem probably has to do with the lack of a ExternalContext/Request object when running a pipeline through the scheduler. Could anyone let me know if there's a workaround to this?

Thanks in advance!

Jasper


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws