Hi
I put together a servlet that reads a .xml file and a .xsl file , applies
the transformation and writes the PDF output to the response object. The
servlet works fine in the Tomcat test environment in Jbuilder4.0. It fails
when I run it in the standalone Tomcat 3.2.1 instance. I compared the
classpaths in both environments and found them to be the same for my
application. Can somebody please help ?
thanks
Srinivas
Here are the outputs and listing of the source -
+++++++++++++ output from Tomcat standalone ++++++++++++++++++++++++++++++
Set the system property..
loaded the class ...
[ERROR]: Logger not set
org.apache.fop.apps.FOPException
at
org.apache.fop.apps.XSLTInputHandler.getParser(XSLTInputHandler.java:109)
at ConvertXmlServlet.service(ConvertXmlServlet.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
---------
java.lang.reflect.InvocationTargetException:
javax.xml.transform.TransformerFactoryConfigurationError: Provider
org.apache.xalan.p
found
at javax.xml.transform.TransformerFactory.newInstance(Unknown
Source)
at
org.apache.fop.apps.TraxInputHandler.getXMLFilter(TraxInputHandler.java:72)
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.fop.apps.XSLTInputHandler.getParser(XSLTInputHandler.java:102)
at ConvertXmlServlet.service(ConvertXmlServlet.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
---------
javax.xml.transform.TransformerFactoryConfigurationError: Provider
org.apache.xalan.processor.TransformerFactoryImpl not found
at javax.xml.transform.TransformerFactory.newInstance(Unknown
Source)
at
org.apache.fop.apps.TraxInputHandler.getXMLFilter(TraxInputHandler.java:72)
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.fop.apps.XSLTInputHandler.getParser(XSLTInputHandler.java:102)
at ConvertXmlServlet.service(ConvertXmlServlet.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++
+++++++++Servlet listing
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import org.w3c.dom.Document;
import org.xml.sax.*;
import org.apache.xalan.xslt.*;
import org.apache.fop.apps.*;
import org.apache.xalan.processor.TransformerFactoryImpl;
public class ConvertXmlServlet extends HttpServlet
{
private static final String CONTENT_TYPE = "application/pdf";
/**Initialize global variables*/
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
/**Process the HTTP Post request*/
public void service(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException
{
try
{
System.setProperty("javax.xml.transform.TransformerFactory","org.apache.xala
n.processor.TransformerFactoryImpl");
System.out.println("Set the system property..");
//this piece of code has been put in to debug.
Since"org.apache.xalan.processor.TransformerFactoryImpl"
//is being loaded it is avialable in classpath.
Class.forName("org.apache.xalan.processor.TransformerFactoryImpl");
System.out.println("loaded the class ...");
Driver driver = new Driver();
driver.setRenderer(Driver.RENDER_PDF);
InputHandler inputHandler = new XSLTInputHandler(new
File("etac.xml"),new File("etacNested.xsl"));
XMLReader parser = inputHandler.getParser();
response.setContentType(CONTENT_TYPE);
driver.setOutputStream(response.getOutputStream());
driver.render(parser, inputHandler.getInputSource());
System.out.println("Generated pdf successfully ... ");
}catch(Exception e)
{
e.printStackTrace();
}
}
/**Clean up resources*/
public void destroy()
{
}
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++
Setting home to C:\WorkArea\xmlToPdf
Starting tomcat. Check logs/tomcat.log for error messages Context log:
path="" Adding context path="" docBase="C:\WorkArea\xmlToPdf\"
Starting tomcat install="C:\WorkArea\xmlToPdf" home="C:\WorkArea\xmlToPdf"
classPath="C:\Apps\Inprise\JBuilder4\tomcat\lib\webserver.jar;C:\Apps\Inpris
e\JBuilder4\tomcat\lib\jasper.jar;C:\Apps\Inprise\JBuilder4\tomcat\lib\xml.j
ar;C:\Apps\Inprise\JBuilder4\lib\servlet.jar;C:\Apps\Inprise\JBuilder4\lib\w
ebserverglue.jar;C:\WorkArea\xmlToPdf\web-inf\classes;C:\Apps\Inprise\JBuild
er4\lib\servlet.jar;C:\Apps\Apache
Group\Fop-0.20.3rc\build\fop.jar;C:\Apps\Apache
Group\Fop-0.20.3rc\lib\avalon-framework-4.0.jar;C:\Apps\Apache
Group\Fop-0.20.3rc\lib\logkit-1.0b4.jar;C:\Apps\Apache
Group\Fop-0.20.3rc\lib\batik.jar;C:\Apps\Apache
Group\xalan-j_2_3_0\bin\xalan.jar;C:\Apps\Apache
Group\xalan-j_2_3_0\bin\xml-apis.jar;C:\Apps\Apache
Group\xerces-1_4_0\xerces.jar;C:\Apps\Inprise\JBuilder4\jdk1.3\demo\jfc\Java
2D\Java2Demo.jar;C:\Apps\Inprise\JBuilder4\jdk1.3\jre\lib\i18n.jar;C:\Apps\I
nprise\JBuilder4\jdk1.3\jre\lib\jaws.jar;C:\Apps\Inprise\JBuilder4\jdk1.3\jr
e\lib\rt.jar;C:\Apps\Inprise\JBuilder4\jdk1.3\jre\lib\sunrsasign.jar;C:\Apps
\Inprise\JBuilder4\jdk1.3\lib\dt.jar;C:\Apps\Inprise\JBuilder4\jdk1.3\lib\to
ols.jar"
JSP Servlet Started JSP Servlet Started (Echo) Context log path=""
:tomcat.errorPage: init
Context log path="" :jsp: init
<JASPER_LOG> Wed Feb 20 16:07:07 PST 2002 Scratch dir for the JSP engine is:
C:\WorkArea\xmlToPdf\work\localhost_8080</JASPER_LOG> <JASPER_LOG> Wed Feb
20 16:07:07 PST 2002 IMPORTANT: Do not modify the generated
servlets</JASPER_LOG> Context log path="" :default: init
Context log: path="" File not found
C:\WorkArea\xmlToPdf\conf\tomcat-users.xml
Starting endpoint port="8086"
handler="org.apache.tomcat.service.http.HttpConnectionHandler"
Starting endpoint port="8087"
handler="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"
HTTP:GET /ConvertXmlServlet.shtml Feb 20, 2002 4:07:08 PM Context log
path="" :shtml: init
Context log path="" :invoker: init
Set the system property.. loaded the class ... Context log path=""
:ConvertXmlServlet: init
[ERROR]: Logger not set
[INFO]: building formatting object tree
[WARN]: property - "margin" is not implemented yet.
[INFO]: [1]
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[INFO]: [2]
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[INFO]: [3]
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[INFO]: Parsing of document complete, stopping renderer
Set the system property.. loaded the class ... [ERROR]: Logger not set
[INFO]: building formatting object tree
[WARN]: property - "margin" is not implemented yet.
[INFO]: [1]
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[INFO]: [2]
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[INFO]: [3]
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[INFO]: Parsing of document complete, stopping renderer
Set the system property.. loaded the class ... [ERROR]: Logger not set
[INFO]: building formatting object tree
[WARN]: property - "margin" is not implemented yet.
[INFO]: [1]
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[INFO]: [2]
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[INFO]: [3]
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[INFO]: Parsing of document complete, stopping renderer
Set the system property.. loaded the class ... [ERROR]: Logger not set
[INFO]: building formatting object tree
[WARN]: property - "margin" is not implemented yet.
[INFO]: [1]
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[ERROR]: Unknown enumerated value for property 'border-top-style': thin
[ERROR]: Unknown enumerated value for property 'border-bottom-style': thin
[ERROR]: Unknown enumerated value for property 'border-left-style': thin
[ERROR]: Unknown enumerated value for property 'border-right-style': thin
[WARN]: table-layout=auto is not supported, using fixed!
[INFO]: [2]
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[INFO]: [3]
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[WARN]: table-layout=auto is not supported, using fixed!
[INFO]: Parsing of document complete, stopping renderer
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++