Solved

Java XML code can run in VAJ, but cannot run under JRUN!

Posted on 2001-08-01
3
176 Views
Last Modified: 2010-03-31
Hi, all, I have a small question, but it already drive me crazy today. If anyone here familar with both java and XML, i'm very appreciated.

I use Xalan 2.1 and Xerces 1.4.1, I want to render a XML document to HTML, the XML document is generated from another object.

If I save the XML to a standalone xml file, I can use the command line xslt tool to do the render work and ensure the XSL file is correct.

and I use Visual Age for Java (already delete the origional IBM XML parser and use Xalan instead ), it works, i can get the HTML file in console.

the code is below:

=============== code begin ==============
Document xmlMenu = hsm.getUser().getXmlMenu();

TransformerFactory tFactory = TransformerFactory.newInstance();
     Transformer transformer     =
          tFactory.newTransformer(new StreamSource("d:\\Menu.xsl"));
     transformer.transform(new DOMSource(xmlMenu),
          new StreamResult( System.out ));
=============== code end ==============

the XSL is like below:
================ xsl begin ==============
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
     <xsl:template match="/">
     
<HTML>
<HEAD>


...
...
=============== xsl end ==================


But if I run it in JRun, it report a exception:

Exception thrown on line '17' from page 'E:\\JRun\\servers\\default\\SCMS\\banner.jsp'.
javax.xml.transform.TransformerConfigurationException: Namespace not supported by SAXParser
     at org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:704)
     at jrun__banner2ejspb._jspService(jrun__banner2ejspb.java:89)
     at allaire.jrun.jsp.HttpJSPServlet.service(../jsp/HttpJSPServlet.java:39)
     at allaire.jrun.jsp.JSPServlet.service(../jsp/JSPServlet.java:228)


How could it be?
To confirm jrun is using Xalan, i put the class files in WEB-INF/classes instead of WEB-INF/lib, and i can see it's a Xalan exception.

If anyone can help, thank you very much!
0
Comment
Question by:Xiaogang
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
ozymandias earned 250 total points
ID: 6340819
The factory object is returning an instance of a transformer based on some internal set of rules.

Either a) the class path in VAJ is different to that of JRun and JRun is finding a different Transformer object from VAJ, or

b) when the code runs in VAJ it somehow affects the decision of the factory method about which type of transformer to return.
0
 

Author Comment

by:Xiaogang
ID: 6343182
Yes, ozymandias, i know that exactly.
Thank god I already get the answer from XML board.
you can goto qid=20161357 to get the thread.

anyway, you are the only one who answer my question here, thank you very much, and i want to express my appreciate by accept u as answer.

Thanks!
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 6343552
That's very gracious of you.
Thanks.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Protect jar file - windows app 2 65
varialbe initialization 11 37
tomcat startup error 5 106
passing enum to a method 4 23
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question