You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Roel Dillen <di...@scarlet.be> on 2007/06/20 11:48:05 UTC
apache fop and security manager problem
I wrote a servlet converting some xml to a pdf. The code (appended) is
basically a slightly modified version of the example code in the fop faq
about servlets.
When I start Tomcat 5.5 with a security manager I get this weird exception
(appended) when I try to access the servlet.
When I don’t start it with a security manager the servlet just works.
I don’t get why.
I added following jars to my common/endorsed folder:
serializer-2.7.0.jar
xalan-2.7.0.jar
xercesImpl-2.7.1.jar
The other jar’s that came with fop are in common/lib, contents of that
folder:
avalon-framework-4.2.0.jar
batik-all-1.6.jar
commons-el.jar
commons-io-1.1.jar
commons-logging-1.0.4.jar
fop.jar
jasper-compiler-jdt.jar
jasper-compiler.jar
jasper-runtime.jar
jsp-api.jar
naming-factory-dbcp.jar
naming-factory.jar
naming-resources.jar
servlet-api.jar
xml-apis-1.3.02.jar
xmlgraphics-commons-1.1.jar
Any thoughts?
Sincerely
Roel
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.
org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.j
ava:224)
org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:98)
org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:147)
org.apache.fop.apps.Fop.<init>(Fop.java:82)
org.apache.fop.apps.FopFactory.newFop(FopFactory.java:204)
be.jprupel.Dbase.Static.FopExport.doPost(FopExport.java:92)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Unknown Source)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:16
1)
code:
ByteArrayOutputStream out = new
ByteArrayOutputStream();
FopFactory ff=FopFactory.newInstance();
TransformerFactory
tf=TransformerFactory.newInstance();
StreamSource xslfo=new
StreamSource(Doc.localContext.concat("/lid-pdf.xsl"));
try {
Templates tt=tf.newTemplates(xslfo);
Fop fp=ff.newFop(MimeConstants.MIME_PDF,
out);
DOMResult res = new DOMResult();
Source src= new DOMSource(doc);
tt.newTransformer().transform(src, res);
Transformer t2=tf.newTransformer();
t2.transform(new DOMSource(res.getNode()), new
SAXResult(fp.getDefaultHandler()));
//Prepare response
response.setContentType("application/pdf");
response.setContentLength(out.size());
//Send content to Browser
response.getOutputStream().write(out.toByteArray());
response.getOutputStream().flush();
} catch (FOPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (TransformerConfigurationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (TransformerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.472 / Virus Database: 269.9.1/854 - Release Date: 19/06/2007
13:12