Solved

XSL transform Tomact

Posted on 2002-04-03
11
286 Views
Last Modified: 2013-11-23
0
Comment
Question by:bqchristie
[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
11 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 6916541
 What is the question?
0
 

Author Comment

by:bqchristie
ID: 6916571
I have a Jsp custom tag (code below).  When the tag is called i get an error saying that the class:
 javax.xml.transform.Source cannot be found.

in the WEB-APPS/myapp/WEB-INF/lib directory i have xalan.jar xml-apis.jar xerces.jar and xercesImpl.jar

what else is it looking for?  could there be a conflict? am i missing something?



import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;
import org.jdom.output.XMLOutputter;
import org.jdom.output.DOMOutputter;
import org.jdom.transform.JDOMSource;
import org.w3c.dom.Document;
import java.io.File;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import org.jdom.transform.JDOMSource;
import org.jdom.transform.JDOMResult;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import java.io.*;
import java.util.*;
import com.dceg.actions.*;
import com.dceg.utils.*;
import java.sql.*;

public class RenderTable extends TagSupport{
  private NavigableList list = null;
  public int doStartTag() {
    try {
      NavigableList list = (NavigableList)pageContext.getSession().getAttribute(Constants.GAME_LIST);
      try {
        DOMOutputter outputter = new DOMOutputter();
        Document domXML = outputter.output(list.getXml());
        Source xmlSource = new DOMSource(domXML);
        Document domXSL = outputter.output(list.getXsl());
        Source xslSource = new DOMSource(domXSL);
        StreamResult xmlResult = new StreamResult(pageContext.getOut());
        TransformerFactory tFactory = TransformerFactory.newInstance();
        Transformer transformer = tFactory.newTransformer(xslSource);
        transformer.transform(xmlSource, xmlResult);
        transformer.clearParameters();
      }catch(Exception e){
        e.printStackTrace();
      }
    } catch(Exception e) {
      e.printStackTrace();
    }

    return (TagSupport.EVAL_PAGE);
  }
  /**
   *
   */
  public static void main(String[] args) {
  }
}
0
 
LVL 35

Accepted Solution

by:
girionis earned 200 total points
ID: 6916596
 If it can find the rest fo the classes in the package (e.g. javax.xml.transform.Result) and not the Source class this means that you might be using an older version of the jar file. If it cannot find all of the specific classes in the package then this means that it cannot find the jar file. I would suggest you extract all the jar file's content's under the WEB-INF/lib folder or specify the path to explicitly look at each jar file.

  Hope it helps.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:bqchristie
ID: 6916651
I tried that with no luck.  I am pretty stumped. Thanks
for trying.
0
 

Author Comment

by:bqchristie
ID: 6916682
i unjarred the xml-apis.jar in the common/classes folder and now get a differenet error.  


javax.servlet.ServletException: Provider for javax.xml.transform.TransformerFactory cannot be found
0
 
LVL 35

Expert Comment

by:girionis
ID: 6916740
 It is probably a classpath problem but it is difficult to say without seeing your whole environment. Try to put manually all the jar file and class subdirectories into your classpath and try again... Apart from this I do not know what else I could think of...
0
 
LVL 3

Expert Comment

by:rjackman
ID: 6920106
hi
I think it is not able to pick up ur Jars
pls set the classpath before starting tomcat
u should have all ur jars in the classpath
i think this will solve the problem
cheers
RJ
0
 

Author Comment

by:bqchristie
ID: 6920773
Thanks for the comment.  As it turns out I just grabbed the latest JAXP jars from javasoft and everything worked fine.  I am still a bit stumped though because everything was running fine under Tomcat 4.0.1.
0
 
LVL 35

Expert Comment

by:girionis
ID: 6921757
 I guess every new release of a web server/Sevrlet engine has a bit different way to deal with loading the appropriate classes.
0
 
LVL 1

Expert Comment

by:rxolotl
ID: 6932314
I have this problem, i solve it installing an replacing that .jar files for JAXP .jar files.
This jar files must be in the CLASSPATH
You can download JAXP from sun site.
0
 

Author Comment

by:bqchristie
ID: 6932345
Seems that updating with a newer version of the jar files did the trick.  
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Certificat to iSeries KeyStore 1 30
Facing this issue for maven proxy setting 2 43
Running JavaFX on the Raspberry Pi 27 277
Java array 21 148
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…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
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.
Suggested Courses

737 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