• Post Reply Bookmark Topic Watch Topic
  • New Topic

URGENT!!!! Xalan problem in Servlet with JRun

Nehal Dave
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to implement the servlet sample which comes along with Xalan jar file. the servlet code is as follows:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.net.URL;
import java.net.MalformedURLException;

import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
* This sample applies the todo.xsl stylesheet to the
* todo.xml XML document, and returns the transformation
* output (HTML) to the client browser.
* IMPORTANT: For this to work, you must place todo.xsl and todo.xml
* in the servlet root directory for documents.
public class SimpleXSLTServlet extends HttpServlet {
public void init(ServletConfig config) throws ServletException
public void doGet (HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException, java.net.MalformedURLException
// The servlet returns HTML.
response.setContentType("text/html; charset=UTF-8");
// Output goes in the response stream.
PrintWriter out = response.getWriter();
TransformerFactory tFactory = TransformerFactory.newInstance();
// Get the XML input document and the stylesheet.
Source xmlSource = new StreamSource(new URL("http://localhost:8100/fooparam.xml").openStream());
Source xslSource = new StreamSource(new URL("http://localhost:8100/fooparam.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(MalformedURLException e)
catch (Exception e)


fooparam.xml is
<?xml version="1.0"?>
fooparam.xsl is
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl aram name="param1" select="'default value'"/>
<xsl:template match="doc">
<head><title>Stylesheet parameter</title></head>
<h2>XML source</h2>
<p><xsl:value-of select="."/></p>
<h2>Stylesheet parameter</h2>
<p>The param1 stylesheet parameter has been set to <xsl:value-of select="$param1"/>.</p>
I have included xerces.jar & xalan.jar in the classpath of JRun.
following is the error when i try to access the servlet
Namespace not supported by SAXParserjavax.xml.transform.TransformerConfigurationException: Namespace not supported by SAXParser at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:764) at SimpleXSLTServlet.doGet(SimpleXSLTServlet.java:104) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service .......
Please help me !!!
William Brogden
Author and all-around good cowpoke
Posts: 13078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this may be due to a separate classpath being used for user servlets. Look at the property named "user.classpath" in the local.properties file for your application.
Which version of JRun is this?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!