aspose file tools*
The moose likes XML and Related Technologies and the fly likes URGENT!!!! Xalan problem in Servlet with JRun 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 "URGENT!!!! Xalan problem in Servlet with JRun" Watch "URGENT!!!! Xalan problem in Servlet with JRun" New topic

URGENT!!!! Xalan problem in Servlet with JRun

Nehal Dave

Joined: Dec 22, 2000
Posts: 28
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 javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.Source;
* 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,
// 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="" 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( at SimpleXSLTServlet.doGet( at javax.servlet.http.HttpServlet.service( at javax.servlet.http.HttpServlet.service .......
Please help me !!!
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12788
I think this may be due to a separate classpath being used for user servlets. Look at the property named "user.classpath" in the file for your application.
Which version of JRun is this?
I agree. Here's the link:
subject: URGENT!!!! Xalan problem in Servlet with JRun