FopServlet - XSLTInputHandler

I am trying to run fop using a servlet using
http://127.0.0.1:8080/examples/servlet/FopTestServlet?xml=krusty.xml&xsl=krusty.xsl
but it is getting the error and code (this is example from FOP with some minor modifications) below.
Code compiles fine...
Server running tomcat 331 and jdk1.3.
Any suggestions anyone.
Internal Servlet Error:
java.lang.NoClassDefFoundError: org/apache/fop/apps/XSLTInputHandler
     at java.lang.Class.newInstance0(Native Method)
     at java.lang.Class.newInstance(Class.java:232)
     at org.apache.tomcat.facade.ServletHandler.getServlet(ServletHandler.java:346)
     at org.apache.tomcat.facade.ServletHandler.preInit(ServletHandler.java:439)
     at org.apache.tomcat.facade.ServletHandler.init(ServletHandler.java:228)
     at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:472)
     at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
     at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
     at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
     at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
     at java.lang.Thread.run(Thread.java:479)
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.apache.fop.apps.Driver;
import org.apache.fop.apps.Version;
import org.apache.fop.apps.XSLTInputHandler;
import org.apache.log.*;
public class FopTestServlet extends HttpServlet {
public static final String FO_REQUEST_PARAM = "fo";
public static final String XML_REQUEST_PARAM = "xml";
public static final String XSL_REQUEST_PARAM = "xsl";
Logger log = null;
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException {
if(log == null) {
// Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();
// log = hierarchy.getLoggerFor("fop");
// log.setPriority(Priority.WARN);
try {
String foParam = request.getParameter(FO_REQUEST_PARAM);
String xmlParam = request.getParameter(XML_REQUEST_PARAM);
String xslParam = request.getParameter(XSL_REQUEST_PARAM);
     PrintWriter out = response.getWriter();
if (foParam != null) {
FileInputStream file = new FileInputStream(foParam);
// renderFO(new InputSource(file), response);
} else if((xmlParam != null) && (xslParam != null)) {
XSLTInputHandler input = new XSLTInputHandler(new File(xmlParam), new File(xslParam));
// renderXML(input, response);
} else {
// PrintWriter out = response.getWriter();
out.println("<html><head><title>Error</title></head>\n"+
"<body><h1>FopServlet Error</h1><h3>No 'fo' "+
"request param given.</body></html>");
     out.println("<html><head><title>Test</title></head>\n"+
"<body><h1>FopServlet Error</h1><h3>xml: "+xmlParam+"<br>xsl: "+xslParam+"<br>fo: "+foParam+"</h3>"+
"</body></html>");
//     catch (ServletException ex) {
// throw ex;
catch (Exception ex) {
throw new ServletException(ex);
}

U can check ur fop.jar
I found fop.jar about 900k do without xsltinputhandler.

Similar Messages

  • XSLTINPUTHANDLER not found in WAR file.

    I am doing a build on Unix box and deploying it as WAR. Till yesterday my XML to PDF was working till the point of invoking the acrobat reader. But since this morning I have started getting this error during startup
    <Jun 8, 2004 10:01:43 AM PDT> <Error> <HTTP> <101250> <[ServletContext(id=292903
    3,name=web.war,context-path=/c2c)]: Servlet class com.sony.spe.c2c.util.PDFServl
    et for servlet PDFservlet could not be loaded because a class on which it depend
    s was not found in the classpath /opt/bea/user_projects/itsm/ITSM_Server/.wlnotd....................
    Then I get when calling the XML to PDF servlet...
    <Jun 8, 2004 10:01:43 AM PDT> <Error> <HTTP> <101250> <[ServletContext(id=292903
    3,name=web.war,context-path=/c2c)]:
    Servlet class com.sony.spe.c2c.util.PDFServlet for servlet PDFservlet could not be loaded because a class on which it depends was not found in the classpath /opt/bea/user_projects/itsm/ITSM_Server/.wlnotd
    I checked the path and the class does exist ..whats happening? It fact during build PDFServlet compiles fine.

    The second error message should be
    java.lang.NoClassDefFoundError: org/apache/fop/apps/XSLTInputHandler
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
    mpl.java:791)
    at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
    java:517)

  • How to generate pdf from servlet?

    i have problem when running sample FopServlet in fop-0.20.3xxx version, the error seems like NoClassDefFoundError: org/apache/fop/apps/XSLTInputHandler as follow A):
    the structure i place the FopServlet looks like ; where did i do it wrong?
    for i am not familiar with sax and fop, so hope could get a sample which can run or someone else would like to tell me the methods that must be done to make servelt be able to generate pdf!
    thanks in advice,
    <code>
    weapps
    |
    + ---fop
    |
    + WEB-INF
    |
    +---classes
    |
    + -------- FopServlet
    </code>
    A)
    javax.servlet.ServletException: Error instantiating servlet class FopServlet
         at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:829)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:615)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
         at java.lang.Thread.run(Thread.java:484)
    root cause
    java.lang.NoClassDefFoundError: org/apache/fop/apps/XSLTInputHandler
         at java.lang.Class.newInstance0(Native Method)
         at java.lang.Class.newInstance(Class.java:237)
         at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:820)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:615)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
         at java.lang.Thread.run(Thread.java:484)

    now i am able to see the result generated via FopServlet, but another question now aroused, that's -how am i able to generate *.fo on the fly by which the servlet make use of it to create pdf file.
    thanks in advice,

  • Converting xml/xsl to pdf

    Hi,
    I am using apache's FOP 0.20.3, xerces 2.0.0.beta4 and xalan j.2.2.0 to convert xml/xsl file to pdf. The code is same as the one given in the org.apache.fop.apps.Driver class.
    <pre>
         Driver driver = new Driver();
         driver.setRenderer(Driver.RENDER_PDF);
         InputHandler inputHandler = new XSLTInputHandler(new File(xmlFile), new File(xslFile));
         try
              XMLReader parser = inputHandler.getParser();
              driver.setOutputStream(new FileOutputStream(outFile));
              driver.render(parser, inputHandler.getInputSource());
         catch (FOPException fope)
              fope.printStackTrace();
         catch (FileNotFoundException fnfe)
              fnfe.printStackTrace();
    </pre>
    The xml and xsl files I am using are glossary.xml and glossary.xsl files that come with FOP.
    Now, this code compiles successfully and while running gives the following exception:
    <pre>
    [ERROR]: Logger not set
    [INFO]: building formatting object tree
    [INFO]: [1]
    org.apache.fop.apps.FOPException: java.lang.NullPointerException
         at org.apache.fop.apps.Driver.render(Driver.java:486)
         at XmlToPdf2.<init>(XmlToPdf2.java:28)
         at XmlToPdf2.main(XmlToPdf2.java:42)
    java.lang.RuntimeException: java.lang.NullPointerException
         at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1132)
         at org.apache.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:134)
         at org.apache.fop.apps.Driver.render(Driver.java:481)
         at XmlToPdf2.<init>(XmlToPdf2.java:28)
         at XmlToPdf2.main(XmlToPdf2.java:42)
    java.lang.RuntimeException: java.lang.NullPointerException
         at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3170)
         at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:433)
         at org.apache.xerces.parsers.AbstractSAXParser.endDocument(AbstractSAXParser.java:629)
         at org.apache.xerces.impl.XMLNamespaceBinder.endDocument(XMLNamespaceBinder.java:702)
         at org.apache.xerces.impl.dtd.XMLDTDValidator.endDocument(XMLDTDValidator.java:974)
         at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(XMLDocumentScannerImpl.java:445)
         at org.apache.xerces.impl.XMLEntityManager.endEntity(XMLEntityManager.java:1123)
         at org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(XMLEntityManager.java:3078)
         at org.apache.xerces.impl.XMLEntityManager$EntityScanner.skipSpaces(XMLEntityManager.java:2766)
         at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(XMLDocumentScannerImpl.java:995)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:332)
         at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:510)
         at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:557)
         at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:148)
         at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1096)
         at org.apache.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:134)
         at org.apache.fop.apps.Driver.render(Driver.java:481)
         at XmlToPdf2.<init>(XmlToPdf2.java:28)
         at XmlToPdf2.main(XmlToPdf2.java:42)
    java.lang.RuntimeException: java.lang.NullPointerException
         at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1132)
         at org.apache.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:134)
         at org.apache.fop.apps.Driver.render(Driver.java:481)
         at XmlToPdf2.<init>(XmlToPdf2.java:28)
         at XmlToPdf2.main(XmlToPdf2.java:42)
    java.lang.RuntimeException: java.lang.NullPointerException
         at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3170)
         at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerHandlerImpl.java:433)
         at org.apache.xerces.parsers.AbstractSAXParser.endDocument(AbstractSAXParser.java:629)
         at org.apache.xerces.impl.XMLNamespaceBinder.endDocument(XMLNamespaceBinder.java:702)
         at org.apache.xerces.impl.dtd.XMLDTDValidator.endDocument(XMLDTDValidator.java:974)
         at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(XMLDocumentScannerImpl.java:445)
         at org.apache.xerces.impl.XMLEntityManager.endEntity(XMLEntityManager.java:1123)
         at org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(XMLEntityManager.java:3078)
         at org.apache.xerces.impl.XMLEntityManager$EntityScanner.skipSpaces(XMLEntityManager.java:2766)
         at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(XMLDocumentScannerImpl.java:995)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:332)
         at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:510)
         at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:557)
         at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:148)
         at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1096)
         at org.apache.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:134)
         at org.apache.fop.apps.Driver.render(Driver.java:481)
         at XmlToPdf2.<init>(XmlToPdf2.java:28)
         at XmlToPdf2.main(XmlToPdf2.java:42)
    </pre>
    Can anybody help?

    Hi,
    I also facing same problem,did you get the solution.
    I am using apache's FOP 0.20.3, xerces-1.2.3 and xalan-2.0.0 and jdk1.3 with weblogic5.1 to convert xml/xsl file to pdf. The code is same as the one given in the org.apache.fop.apps.Driver class.
    please give me sample code.
    thanks,
    [email protected]

  • XSL/Fo to PDF using Servlet

    Hi all!
    I want to to write a servlet which should convert a XSL/FO /XML file to a PDF format..i tried to do so.. but i am getting this error.. and i added the relevent Jars..please help in this regard.thanks in advance..
    SRVE0026E: [Servlet Error]-[com.foptest.FopServlet]: java.lang.NoSuchMethodError: org.apache.fop.apps.Fop: method <init>(Ljava/lang/String;Lorg/apache/fop/apps/FOUserAgent;Ljava/io/OutputStream;)V not found

    Hi Shah H
    Thank you for your answer !
    Well, how can I explain you more in detail ?
    After the standard give me the Data to show it with an SAP Script Form (OTF structure) I have found a way how to convert them into a XML structure.
    Together with a XSL file than we pass the file to a print system. There they print the forms.
    In the same time to this we want to look also the form at the screen.
    To guarantee that we see the same result as from the print screen we also want to create the PDF from the same source. That means from the XML and XSL files. So to convert them to a PDF file  I think I must go outside the system.
    Now, I have read that as you also mention this is possible thru Apache project or cocoon.
    But how exactly must this be configured I never have done this before:
    - On with transaction in SAP can this be configured ?
    - Which customizing must be done ?
    Are this explanations comprehensible for you ?
    Thanks in advantage
    Sandro

  • Large Pdf using XML XSL - Out of Memory Error

    Hi Friends.
    I am trying to generate a PDF from XML, XSL and FO in java. It works fine if the PDF to be generated is small.
    But if the PDF to be generated is big, then it throws "Out of Memory" error. Can some one please give me some pointers about the possible reasons for this errors. Thanks for your help.
    RM
    Code:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import org.xml.sax.InputSource;
    import org.xml.sax.XMLReader;
    import org.apache.fop.apps.Driver;
    import org.apache.fop.apps.Version;
    import org.apache.fop.apps.XSLTInputHandler;
    import org.apache.fop.messaging.MessageHandler;
    import org.apache.avalon.framework.logger.ConsoleLogger;
    import org.apache.avalon.framework.logger.Logger;
    public class PdfServlet extends HttpServlet {
    public static final String FO_REQUEST_PARAM = "fo";
    public static final String XML_REQUEST_PARAM = "xml";
    public static final String XSL_REQUEST_PARAM = "xsl";
    Logger log = null;
         Com_BUtil myBu = new Com_BUtil();
    public void doGet(HttpServletRequest request,
    HttpServletResponse response) throws ServletException {
    if(log == null) {
         log = new ConsoleLogger(ConsoleLogger.LEVEL_WARN);
         MessageHandler.setScreenLogger(log);
    try {
    String foParam = request.getParameter(FO_REQUEST_PARAM);
    String xmlParam = myBu.getConfigVal("filePath") +"/"+request.getParameter(XML_REQUEST_PARAM);
    String xslParam = myBu.SERVERROOT + "/jsp/servlet/"+request.getParameter(XSL_REQUEST_PARAM)+".xsl";
         if((xmlParam != null) && (xslParam != null)) {
    XSLTInputHandler input = new XSLTInputHandler(new File(xmlParam), new File(xslParam));
    renderXML(input, response);
    } else {
    PrintWriter out = response.getWriter();
    out.println("<html><head><title>Error</title></head>\n"+
    "<body><h1>PdfServlet Error</h1><h3>No 'fo' "+
    "request param given.</body></html>");
    } catch (ServletException ex) {
    throw ex;
    catch (Exception ex) {
    throw new ServletException(ex);
    public void renderXML(XSLTInputHandler input,
    HttpServletResponse response) throws ServletException {
    try {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    response.setContentType("application/pdf");
    Driver driver = new Driver();
    driver.setLogger(log);
    driver.setRenderer(Driver.RENDER_PDF);
    driver.setOutputStream(out);
    driver.render(input.getParser(), input.getInputSource());
    byte[] content = out.toByteArray();
    response.setContentLength(content.length);
    response.getOutputStream().write(content);
    response.getOutputStream().flush();
    } catch (Exception ex) {
    throw new ServletException(ex);
    * creates a SAX parser, using the value of org.xml.sax.parser
    * defaulting to org.apache.xerces.parsers.SAXParser
    * @return the created SAX parser
    static XMLReader createParser() throws ServletException {
    String parserClassName = System.getProperty("org.xml.sax.parser");
    if (parserClassName == null) {
    parserClassName = "org.apache.xerces.parsers.SAXParser";
    try {
    return (XMLReader) Class.forName(
    parserClassName).newInstance();
    } catch (Exception e) {
    throw new ServletException(e);

    Hi,
    I did try that initially. After executing the command I get this message.
    C:\>java -Xms128M -Xmx256M
    Usage: java [-options] class [args...]
    (to execute a class)
    or java -jar [-options] jarfile [args...]
    (to execute a jar file)
    where options include:
    -cp -classpath <directories and zip/jar files separated by ;>
    set search path for application classes and resources
    -D<name>=<value>
    set a system property
    -verbose[:class|gc|jni]
    enable verbose output
    -version print product version and exit
    -showversion print product version and continue
    -? -help print this help message
    -X print help on non-standard options
    Thanks for your help.
    RM

  • Page Not Responding (Streaming PDF)

    I'm not sure if this is related to my code or just the app I'm customizing, but here is the problem.
    I'm using FOP (Apache's Formatting Object's Processor) XML Graphics project.
    In any case, I'm creating this PDF on the fly and then streaming it back to the client as application/pdf. The PDF opens properly. However, the buttons on the page do not respond once the PDF opens. The page in question is part of a frameset, so when I hit the F5 (Refresh) button, all frames reload and the app responds as expected.
    Here is some of the code:
    XSLTInputHandler input = new XSLTInputHandler(new InputSource(new ByteArrayInputStream(myXML.getBytes("UTF-8"))), new InputSource(xsltStream));
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    Logger log = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG);
    MessageHandler.setScreenLogger(log);
    Driver driver = new Driver();
    driver.setLogger(log);
    driver.setRenderer(Driver.RENDER_PDF);
    driver.setOutputStream(out);
    input.run(driver);
    HttpServletResponse response = (HttpServletResponse)getPageContext().getResponse();
    response.setContentType("application/pdf");
    response.addHeader("Content-Disposition", "attachment; filename=Report.pdf");
    byte[] content = out.toByteArray();
    response.setContentLength(content.length);
    response.getOutputStream().write(content);
    response.getOutputStream().flush();
    response.getOutputStream().close();Any one has any thoughts on this?

    it seems that once I call flush(), I no longer have a page, even though I can see it. I can't even view source for the page. I can, off course, refresh the page, then everything start working again...

  • Java.lang.IllegalArgumentException: org.apache.fop.svg.SVGElementMapping

    Hi,
    I have an FOP application which presents the data retrieved from database in a PDF format.
    Now when Iam trying to deploy the FOP application to OC4J and I get the following error.
    java.lang.IllegalArgumentException: org.apache.fop.svg.SVGElementMapping is not an ElementMapping
         at org.apache.fop.apps.Driver.addElementMapping(Driver.java:464)
         at org.apache.fop.apps.Driver.setupDefaultMappings(Driver.java:314)
         at org.apache.fop.apps.Driver.<init>(Driver.java:222)
         at org.appfuse.fop.FOPHelper.createPDF(FOPHelper.java:48)
         at FOPServlet.execute(FOPServlet.java:168)
         at FOPServlet.doPost(FOPServlet.java:109)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    I believe its the problem with the class loaders.
    I even configured my orion-web.xml to load the local classes and following is the conf file:
    <orion-web-app
         deployment-version="9.0.4.0.0"
         temporary-directory="./temp"
         internationalize-resources="false"
         default-mime-type="application/octet-stream"
         servlet-webdir="/servlet/"
    >
         <web-app-class-loader search-local-classes-first="true" include-war-manifest-class-path="false" />
    </orion-web-app>
    I have loaded the most stable jar files(fop-0.20.5) required for the generation of PDF.
    The same application runs well in JDeveloper(10.1.2.0.0)
    Could somebody help me out with this.
    Its very urgent.
    Need to be able to deploy this by evening.
    Thanks
    Sridhar
    Message was edited by:
    Sridhar

    This means the code loading the element mappings does not recognize
    the SVGElementMapping as an ElementMapping, as it expects. The most
    likely reason is that they are loaded from different class loaders -That was the reason of my simple suggestion above.
    There are many ways that you can try now.
    One way is to put all libraries in your war into ORACLE_HOME/j2ee/home/applib. Also remove the following line
    <web-app-class-loader search-local-classes-first="true" include-war-manifest-class-path="false" />
    since this search-local-classes-first is problematic sometimes.
    It might be nice if you can verify that the classloader that loads SVGElementMapping is different from the one that loads Elementmapping at that point of code.
    Now Could somebody help me out as this is the problem of OC4J .Hmm, I would not say "problem of OC4J". A usage error or a false incompatibility at worst. "False" because there should be many normal and standard ways to make it work.

  • Oracle XDK and FOP 0.20.4 not working...

    Hi all,
    We have created a sample application with Apache FOP to obtain a PDF document.
    But, although it works fine with XERCES and XALAN, it doesn4t work with Oracle XDK, why?
    May it be a bug in Oracle XDK? Or do Apache projects implements something non-standard that is used? Or is Oracle who does not implement all the specification?
    This is the sample: (in perfect spanish ;-) )
    You only should change the file locations and the System.setParameters and libraries to use Apache or Oracle XDK.
    Can anybody help us?
    Thanks in advance
    Jose R.
    TESTFO.java:
    package es.aranzadi.fo;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    import javax.xml.transform.sax.*;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.SAXParser;
    import javax.xml.transform.sax.SAXSource;
    import java.io.*;
    import org.xml.sax.InputSource;
    import org.xml.sax.EntityResolver;
    import org.xml.sax.XMLReader;
    import org.xml.sax.helpers.XMLReaderFactory;
    import org.apache.fop.apps.Driver;
    import org.apache.fop.layout.Page;
    import org.apache.fop.apps.Version;
    import org.apache.fop.apps.XSLTInputHandler;
    import org.apache.fop.messaging.MessageHandler;
    import org.apache.fop.render.awt.AWTRenderer ;
    import java.net.URL;
    public class TestFo
    public TestFo()
    public static void main (String [] args) throws Exception
    TestFo tf= new TestFo();
    tf.go();
    public void go() throws Exception
    // THIS IS FOR ORACLE XDK
    System.setProperty("javax.xml.transform.TransformerFactory","oracle.xml.jaxp.JXSAXTransformerFactory");
    System.setProperty("javax.xml.parsers.SAXParserFactory","oracle.xml.jaxp.JXSAXParserFactory");
    System.setProperty("org.xml.sax.parser","oracle.xml.parser.v2.SAXParser");
    // THIS IS FOR APACHE XALAN AND XERCES
    //System.setProperty("javax.xml.transform.TransformerFactory","org.apache.xalan.processor.TransformerFactoryImpl");
    //System.setProperty("javax.xml.parsers.SAXParserFactory","org.apache.xerces.jaxp.SAXParserFactoryImpl");
    Driver driver = new Driver();
    driver.setOutputStream(getResultOutputStream());
    driver.setRenderer(Driver.RENDER_PDF);
    Transformer transformer= (TransformerFactory.newInstance()).newTransformer(getXSLSource());
    transformer.transform(getXMLSource(), new SAXResult(driver.getContentHandler()));
    public StreamSource getXSLSource() throws Exception
    return new StreamSource(new File("YOUR_PATH\\myPrueba.xsl"));
    public SAXSource getXMLSource() throws Exception
    File fichero=new File("YOUR_PATH\\myPrueba.xml");
    InputSource is=new InputSource(new FileReader(fichero));
    is.setSystemId("file://YOUR_PATH\\\\myPrueba.xml");
    is.setEncoding("iso-8859-1");
    return new SAXSource(is);
    public OutputStream getResultOutputStream() throws Exception
    File fichero=new File("YOUR_PATH\\pruebafo.pdf");
    return new FileOutputStream(fichero);
    myPrueba.xsl
    <?xml version="1.0" encoding="iso-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xml.apache.org/fop/extensions">
    <xsl:template match="/">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <fo:layout-master-set>
    <fo:simple-page-master master-name="my-page">
    <fo:region-body margin="1in"/>
    </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="my-page">
    <fo:flow flow-name="xsl-region-body">
    <fo:block>
    <xsl:apply-templates select="prueba"/>
    </fo:block>
    </fo:flow>
    </fo:page-sequence>
    </fo:root>
    </xsl:template>
    </xsl:stylesheet>
    miPrueba.xml
    <?xml version="1.0" encoding="iso-8859-1"?>
    <prueba>
    Hola mundo
    </prueba>

    Sorry, this is the exception:
    java.lang.NullPointerException
    java.lang.NullPointerException
         at oracle.xml.jaxp.JXTransformer.reportXSLException(JXTransformer.java:720)
         at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:304)
         at oracle.xml.jaxp.JXTransformerHandler.endDocument(JXTransformerHandler.java:137)
         at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:263)
         at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:146)
         at oracle.xml.jaxp.JXXMLFilter.parse(JXXMLFilter.java:91)
         at org.apache.fop.apps.Driver.render(Driver.java:481)
         at es.aranzadi.documentos.pruebaFOP.metodoB(pruebaFOP.java:120)
         at es.aranzadi.documentos.pruebaFOP.main(pruebaFOP.java:41)

  • Integrate struts with fop

    hi i successfully created a pdf file using fop in a command line. i give the xml and xsl and then automatically generates pdf. Now, i need to integrate fop with struts. i am using action but i am getting an error constructor XSLTInputHandler(String,String) is undefined. How can i solve it? thanks.
    here is my code:
    public class PDFServlet extends HttpServlet{
         private String xmlFile = "Report.xml";
    private String xslFile = "Report.xsl";
    protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException
    // set up a FOP driver
    Driver driver = new Driver();
    // set up the logger for the driver
    Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
    driver.setLogger(logger);
    try
    //set the renderer to be PDF
    driver.setRenderer(Driver.RENDER_PDF);
    //create the input from the XSLT transform
    XSLTInputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
    // now prepare the outputStrean
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    //set the driver outputStream
    driver.setOutputStream(outStream);
    //do the XSLT
    driver.render(inputHandler.getParser(), inputHandler.getInputSource());
    //now that the content is written in the output stream,
    //get ready to send the response back to browser
    byte[] content = outStream.toByteArray();
    httpServletResponse.setContentLength(content.length);
    // set the MIME-TYPE
    httpServletResponse.setContentType("application/pdf");
    //write the content
    httpServletResponse.getOutputStream().write(content);
    httpServletResponse.getOutputStream().flush();
    } catch (Exception e)
    e.printStackTrace();
    }

    You need "import ???.???.???.XSLTInputHandler;" at the beginning of your class somewhere. Replace the question marks by the name of the package it's in, whatever that might be.

  • OC4J and FOP

    Has anyone got FOP working on OC4J? I have compiled the FopServlet that comes with the download. It does not render a PDF just a blank webpage. Maybe someone else has seen this error?
    Thanks,
    Tom Henricksen

    Here's an excerpt from my j2ee/home/config/application.xml file which should give you some idea as to which jars to use
         <!-- XSQL Server Pages and Formatting Objects - PDF -->
         <library path="../../../lib/xsu12.jar" />
         <library path="../../../lib/oraclexsql.jar" />
         <library path="../../../lib/xsqlserializers.jar" />
         <library path="../../../lib/xmlparserv2.jar" />
         <library path="../../../../../../JLib/Apache/fop-0_16_0/fop.jar" />
         <library path="../../../../../../JLib/Apache/fop-0_16_0/lib/w3c.jar" />

  • FOP and oracle parser

    Hi
    i developed a web application that takes an xml file which the user specifies and after validating it the application uses FOP to produce a PDF file. But the problem is that by default oc4j uses oracle.xml.parser.v2 parser but FOP need xerces. How can i override the usage of oracle's xml parser.
    Please help because i spent quite some time on this project and this is the problem i almost at the end of the project run it to.
    thanks,
    mate

    I did that allready and stil my NullPointerException printout looks like this:
    java.lang.NullPointerException
         void oracle.xml.jaxp.JXTransformer.reportXSLException(oracle.xml.parser.v2.XSLException)
              JXTransformer.java:762
         void oracle.xml.jaxp.JXTransformer.transform(javax.xml.transform.Source, javax.xml.transform.Result)
              JXTransformer.java:335
         void oracle.xml.jaxp.JXTransformerHandler.endDocument()
              JXTransformerHandler.java:135
         void oracle.xml.parser.v2.NonValidatingParser.parseDocument()
              NonValidatingParser.java:269
         void oracle.xml.parser.v2.XMLParser.parse(org.xml.sax.InputSource)
              XMLParser.java:147
         void oracle.xml.jaxp.JXXMLFilter.parse(org.xml.sax.InputSource)
              JXXMLFilter.java:91
         void org.apache.fop.apps.Driver.render(org.xml.sax.XMLReader, org.xml.sax.InputSource)
              Driver.java:498
         void srcsi.pdf.PDFPrikazAction.renderXML(org.apache.fop.apps.XSLTInputHandler, javax.servlet.http.HttpServletResponse)
              PDFPrikazAction.java:135
         org.apache.struts.action.ActionForward srcsi.pdf.PDFPrikazAction.execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
              PDFPrikazAction.java:95
         org.apache.struts.action.ActionForward org.apache.struts.action.RequestProcessor.processActionPerform(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.struts.action.Action, org.apache.struts.action.ActionForm, org.apache.struts.action.ActionMapping)
              RequestProcessor.java:484
         void org.apache.struts.action.RequestProcessor.process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
              RequestProcessor.java:274
         void org.apache.struts.action.ActionServlet.process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
              ActionServlet.java:1482
         void org.apache.struts.action.ActionServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
              ActionServlet.java:525
         void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
              HttpServlet.java:760
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
              HttpServlet.java:853
         void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ResourceFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
              ResourceFilterChain.java:65
         void FilterEncoding.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
              FilterEncoding.java:22
         void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
              ServletRequestDispatcher.java:560
         void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
              ServletRequestDispatcher.java:306
         boolean com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.processRequest(com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.ApplicationServerThread, com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.EvermindHttpServletRequest, com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
              HttpRequestHandler.java:767
         void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(java.lang.Thread)
              HttpRequestHandler.java:259
         void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run()
              HttpRequestHandler.java:106
         void EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run()
              PooledExecutor.java:803
         void java.lang.Thread.run()
              Thread.java:484

  • An simple Example for beginer ...

    Hi:
    I want to generate a pdf-file from somefile.xml and somefile.xsl using fop. And it doesn't work. Could somebody provide a simple example, how to do it? It would be very nice.
    Thanks a lot.

    Here is my code-example:
    import java.io.*;
    import org.apache.fop.apps.*;
    import org.xml.sax.*;
    import java.util.logging.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class TestClass extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
              PrintWriter pw = new PrintWriter(new FileOutputStream("C:/Temp/logFile.log"));
              String xmlFileName = "C:/xml/xmlfile.xml";
              String xslFileName = "C:/xsl/xslfile.xsl";
              ServletOutputStream outStream = response.getOutputStream();
              ByteArrayOutputStream arr = new ByteArrayOutputStream(); 
              try
                   XSLTInputHandler in = new XSLTInputHandler(new File(xmlFileName), new File(xslFileName));         
                   Driver driver = new Driver();           
                   driver.setRenderer(Driver.RENDER_PDF);           
                   driver.setOutputStream(arr);                                   
                   InputSource inputSource = in.getInputSource();           
                   XMLReader xmlReader = in.getParser();   // Error! Unknown Source !!!                                            
                   driver.render(xmlReader, inputSource);       
              catch (Exception ex)
                   ex.printStackTrace(pw);
                   pw.close();
              response.setContentType("application/pdf");
              response.setContentLength(arr.size());
              arr.writeTo(outStream);
              outStream.flush();
    }Any idea? Thanks.

  • Weblogic XMLOutoutStream to java InputStream

    I am using Weblogic XMLOutoutStream to create a XML file on the fly. But instead of using flush() method and writing a physical file onto the disk I want to convert this outputstream to a java InputStream which can then be passed to the FOP XSLT transformer. any ideas?
    Or if this is not the way how should i go about feeding the XSLTTransform( xml,xsd). Note the XML file is to be created dynamically.
    The problem I have is when the entire application is WARred up the system is not able to locate the XML created on the UNIX server disc.

    Thanks guys for the tip..
    The outputstream contains the XML data stream ( entire file stream ).
    The XSL stream is lXSLStream .
    These are passed to XSLTInputHandler as follows in the code. Would this work? My PC is conked off so I wont be able to test till tomorrow..
    Thanks again ..
    File f2 = new File("C:\\tmp\\invoice.xsl");
    FileInputStream lXSLStream = new FileInputStream(f2);
    int bytesRead;
    byte[] buffer = outputstream.toByteArray();
    ByteArrayInputStream in = new ByteArrayInputStream(buffer);
    XSLTInputHandler input =
    new XSLTInputHandler(new InputSource( in),
    new InputSource(lXSLStream));
    renderXML(input, response);

Maybe you are looking for

  • Error code: 0x80070035 The network path was not found

    "Error code: 0x80070035 The network path was not found" while trying to access another PC running Windows 7 Ultimate I searched and read dozens of similiar posts to try to resolve this issue with no success. The situation is, I have a router in home

  • Please Help me sync my IPhone and Ipad to Outlook 2011 calendar

    I am unable to sync my calendar on my iPhone correctly and it will not sync at all on my iPad. I don't want or need to use iCal or iSync (I think) because I am using Exchange 2007 I believe. I can retrieve email, and the calendar loads, but the meeti

  • Freeze on mac

    If I try to load any asset to the library or I try to draw a rectangle, Edge freezes. No way to close the software. What can I do? I'm new to Adobe CC Thanks for Answers Thomas

  • Stop download screen from opening. Firefox 3.6.7 PowerMac g5 (i can only find an answer for windows sytems) Thanks.

    I just want to turn off the download pop up screen. Running 3.6.7 on PowerMac G5 10.5.8. Only solutions I've seen have been windows systems. Thanks == This happened == Every time Firefox opened == since I upgraded to 3.6.7

  • Linking without Map ID?

    My programmers would like users to be directed to the "welcome" topic of my help from multiple screens of the application (either by clicking on Help or hitting F1) without Map IDs being assigned. We are in a situation now where when a user tries to