Solved

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

Posted on 2001-08-01
3
181 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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 …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

734 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