You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Francois Bourgault <f_...@hotmail.com> on 2002/02/27 00:07:38 UTC

Error running Xalan sample: servlet.SimpleXSLTServlet

Hi all,

I'm new to xalan-j_2_2_0 and when I try to run the above Xalan sample, 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);

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

}
catch (Exception e)
{
out.write(e.getMessage());
e.printStackTrace(out);
}
out.close();

It's bombing on:
transformer.transform(xmlSource, new StreamResult(out));


I'm using jdk1.4

I did setup xalanservlet.jar and others 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.


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com