Hi, Iain-
I'd definitely be interested in how this is resolved, particularly if
it's related to OSGI.
-Terence Bandoian
On 11/26/2014 10:23 AM, Iain Soedring wrote:
Thanks Matt, Terence,
This leads me to suspect the problem is with OSGI, I'm currently
repackaging the FOP jars as an OSGI bundle (it's not on springsource
unfortunately). I will update this thread if that resolves it.
Regards,
Iain
From: Matt Kynaston <m...@claritum.com>
To: fop-users@xmlgraphics.apache.org
Date: 24/11/2014 22:18
Subject: Re: FOP failing to transform XSL to PDF with image when run
in tomcat/osgi, but working when run in standalone
------------------------------------------------------------------------
Yeah, ditto that. Mind you, we're also using fop-pdf-images.
I'd review what jars are actually being loaded - this sounds like a
mismatch somewhere.
Ah, java. Run once, run... once.
Matt
On 24 November 2014 at 20:54, Terence M. Bandoian <_terence@tmbsw.com_
<mailto:tere...@tmbsw.com>> wrote:
Hi, Iain-
This may not help much but I've been able to successfully use
fo:external-graphic in FOP 1.0 on Tomcat 6 and Tomcat 7. The images
were JPEG and OSGI was not used.
-Terence Bandoian
On 11/24/2014 9:53 AM, Iain Soedring wrote:
Hi,
I have an xsl file that includes an external image:
<fo:external-graphic src="/images/BrandGraphic.PNG"/>
When running as a standalone Java application the
transformer.transform function works, and I get a valid PDF file.
When running in Tomcat/OSGI, on the same server (same JRE), I get the
following error:
FATAL ERROR: 'java.lang.IllegalArgumentException: Unknown function:
gatherContextInfo'
:Unknown function: gatherContextInfo
If I remove the image from the XSL, everything works.
I checked in the fop 1.0 source, and see that this comes from
org.apache.fop.util.text.AdvancedMessageFormat
public FunctionPart(String functionName) {
this.function = getFunction(functionName);
if (this.function == null) {
throw new IllegalArgumentException("Unknown function: " +
functionName);
}
}
Unfortunately no stack trace is output when catching this exception,
and tracing back through the code I can see various places from where
this could have got called.
the 'gatherContextInfo' function itself is in
org.apache.fop.fo.FONode.java, and is overridden in sub-classes.
On the class-loading side, I've verified that the same jars are loaded
in both tomcat and standalone. The following are the ones that I find
are essential for my transform to work:
avalon, batik, commons-io, commons-logging, xmlgraphics.
On tomcat there are many more libraries loaded, but the only overlap I
can see is commons-logging, where my war file already uses a different
version of this.
I have asked the same question on stackoverflow:
_https://stackoverflow.com/questions/27066409/apachefop-tomcat-osgi-error-java-lang-illegalargumentexception-unknown-functio_,
but I haven't get much response beyond what I'd already looked at so far.
One other issue I found running FOP in Tomcat/OSGI, was the need to
override the PDF renderer, with this code:
FOUserAgent useragent = fopFactory.newFOUserAgent();
PDFRenderer pdfrenderer = new PDFRenderer();
pdfrenderer.setUserAgent(useragent);
useragent.setRendererOverride(pdfrenderer);
fopFactory.addElementMapping(new FOElementMapping());
...
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, useragent, out);
otherwise the code would fail with:
Caused by: java.lang.UnsupportedOperationException: Don't know how to
handle "application/pdf" as an output format. Neither an
FOEventHandler, nor a Renderer could be found for this output format.
at
org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:360)
Does anyone have any idea what could be going wrong here?
Best Regards,
Iain
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with
number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU
---------------------------------------------------------------------
To unsubscribe, e-mail: _fop-users-unsubscribe@xmlgraphics.apache.org_
<mailto:fop-users-unsubscr...@xmlgraphics.apache.org>
For additional commands, e-mail:
_fop-users-help@xmlgraphics.apache.org_
<mailto:fop-users-h...@xmlgraphics.apache.org>
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with
number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org