File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Error running Xalan sample:   servlet.SimpleXSLTServlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Error running Xalan sample:   servlet.SimpleXSLTServlet " Watch "Error running Xalan sample:   servlet.SimpleXSLTServlet " New topic
Author

Error running Xalan sample: servlet.SimpleXSLTServlet

Francois Bourgault
Ranch Hand

Joined: Oct 30, 2001
Posts: 67
Hi all,
I try to run the above Xalan sample and I get the following error:
org.apache.xalan.processor.TransformerFactoryImpljava.lang.ClassCastException: org.apache.xalan.processor.TransformerFactoryImpl at javax.xml.transform.TransformerFactory.newInstance(TransformerFactory.java:148) at servlet.SimpleXSLTServlet.doGet(SimpleXSLTServlet.java:98) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) 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.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at

below is part of the servlet:
try
{
TransformerFactory tFactory = TransformerFactory.newInstance();
// Get the XML input document and the stylesheet.
Source xmlSource = new StreamSource(new URL("file:todo.xml").openStream());
Source xslSource = new StreamSource(new URL("file:todo.xsl").openStream());

// Generate the transformer.
Transformer transformer = tFactory.newTransformer(xslSource);
System.out.println( "1- SimpleXSLTServlet" );

// Perform the transformation, sending the output to the response.
transformer.transform(xmlSource, new StreamResult(out));

System.out.println( "2- SimpleXSLTServlet" );
}
catch (Exception e)
{
System.out.println( "Catch- SimpleXSLTServlet" );
out.write(e.getMessage());
e.printStackTrace(out);
}
out.close();
When I call the servlet thru an HTML page I get:
1- SimpleXSLTServlet
It never gets to the 2nd System.out.println
I did setup xalanservlet.jar in the classpath, but it doesn't work. The very 1st error is a "ClassCastException", Not sure what else I need to setup. Has someone else got the same problem?
Any help would be appreciated.
Francois.
Francois Bourgault
Ranch Hand

Joined: Oct 30, 2001
Posts: 67
I forgot to mention, I use jdk1.4
Francois
Francois Bourgault
Ranch Hand

Joined: Oct 30, 2001
Posts: 67
I forgot to mention, I use jdk1.4
Francois
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error running Xalan sample: servlet.SimpleXSLTServlet
 
Similar Threads
logic:iterate pls any body help me
FopServlet samples from xml.apache.org
inheritance and servlets
URGENT!!!! Xalan problem in Servlet with JRun
server not found