Solved

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

Posted on 2001-08-01
3
180 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses

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