Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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 …
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now