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 Shane_Curcuru/CAM/Lotus <Sh...@lotus.com> on 2002/02/25 16:15:41 UTC

Fwd: Xalan - exception error; servlet.SimpleXSLTServlet

Please send Xalan questions to the list, either xalan-j-users or xalan-dev,
instead of to individual committers.  (Detailed questions about the test
themselves are an exception: if there's anyone else out there who is
actually using the test automation regularly and wants priority support you
can contact me directly!)

In the meantime, see http://xml.apache.org/xalan-j/faq.html#faq-9 and run
the EnvironmentCheck utility from within your servlet.  This is probably a
JDK 1.4 problem since it hides a back-level version of Xalan in it's
rt.jar.

- Shane

----- Forwarded by Shane Curcuruon 02/25/2002 10:12 AM -----
"Francois Bourgault" <f_...@hotmail.com>
Hi Shane,

  I got your name from Xalan Test webpage. I'm getting an exception error,
here's part of the message:

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:97) 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

My setup is jdk1.4 and xalan-j_2_2_0. I'm trying to run xalan sample -
servlet.SimpleXSLTServlet as indicated on Apache's website. I updated my
classpath with jar files - xalan, xml-apis and xalansamples. However I can
find xercesImpl.jar

Below is some code 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)
    {
      out.write( e.getMessage());
      e.printStackTrace(out);
    }
    out.close();
  }

It does print the 1st System.out.println, but when it gets to
"transformer.transform(xmlSource, new StreamResult(out));" that's where the

error happens. Then it goes in the catch statement and stop there. What
else
am I missing?

Thanks,
Francois.


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