HI, I have problems with the following code in the FopServlet that
run in Oracle OC4J:
in the FopServlet I have modified the metod renderFO to add a barcode font:

 /**
     * renders an FO inputsource into a PDF file which is rendered
     * directly to the response object's OutputStream
     */
    public void renderFO(InputSource foFile,
                         HttpServletResponse response) throws
ServletException {
        try {
            ByteArrayOutputStream out = new ByteArrayOutputStream();

            response.setContentType("application/pdf");

            // ---- ATT! ROWS ADDED TO ADD BARCODE FONT ----
            File userConfigFile = new File("C:\\FOP\\userconfig.xml");
            Options options = new Options(userConfigFile);
            // ---- END ROWS ADDED -------------------------

            Driver driver = new Driver(foFile, out);
            driver.setLogger(log);
            driver.setRenderer(Driver.RENDER_PDF);
            driver.run();

            byte[] content = out.toByteArray();
            response.setContentLength(content.length);
            response.getOutputStream().write(content);
            response.getOutputStream().flush();
        } catch (Exception ex) {
            throw new ServletException(ex);
        }
    }

the error is:

java.lang.ClassCastException: oracle.xml.jaxp.JXSAXParserFactory
at javax.xml.parsers.SAXParserFactory.newInstance(Unknown
Source)
at
org.apache.fop.configuration.ConfigurationReader.createParser(Unknown
Source)
at org.apache.fop.configuration.ConfigurationReader.start
(Unknown Source)
at org.apache.fop.apps.Options.loadStandardConfiguration
(Unknown Source)
at org.apache.fop.apps.Options.<init>(Unknown Source)
at org.apache.fop.apps.Options.<init>(Unknown Source)
at FopServlet.renderFO(FopServlet.java:96)
at FopServlet.doGet(FopServlet.java:66)
at javax.servlet.http.HttpServlet.service
(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service
(HttpServlet.java:853)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.ServletRequestDispatcher.invoke
(ServletRequestDispatcher.java:721)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.ServletRequestDispatcher.forwardInternal
(ServletRequestDispatcher.java:306)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.HttpRequestHandler.processRequest
(HttpRequestHandler.java:767)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind[Oracle9iAS (9.0.3.0.0) Containers for
J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run
(PooledExecutor.java:797)
at java.lang.Thread.run(Unknown Source)

Anyone can help me?


Roberto

Reply via email to