Newsgroup: it.comp.java
Titolo: Urgente xml java tomcat

Ho già postato il problema ma non sono stato molto chiaro.
Sto realizzando una applicazione con jsp/servlet.
Sul mio pc ho installato java 1.4 e tomcat 4.0.
Ho inserito una servlet che mi prende un file xml e attraverso un file
xsl me lo trasforma in html. Questo l'ho preso da un esempio su un
libro e vorrei modificarlo perchè mi farebbe molto comodo.
Ecco il listato della servlet:
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import java.io.FileOutputStream;
import org.apache.xerces.parsers.DOMParser;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class TransformServlet extends HttpServlet  {
    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
             throws IOException, ServletException
    {
    String thisProduct_id = request.getParameter("product_id");
    String XMLFileName = "file:///C:/files/products.xml";
    String XSLSheetName = "file:///C:/files/productpage.xsl";
    PrintWriter output = response.getWriter();
 
    try {
    TransformerFactory transFactory =
TransformerFactory.newInstance();
    Transformer transformer = 
               transFactory.newTransformer(new
StreamSource(XSLSheetName));
    DOMParser parser = new DOMParser();
    parser.parse(XMLFileName);
    Document document = parser.getDocument();
    NodeList products =
             document.getElementsByTagName("product_id");
    int num_products = products.getLength();
    String product_id;
    String prev_id;
    String next_id;
    for (int i = 0; i < num_products; i++) {
      product_id = products.item(i)
                           .getChildNodes().item(0).getNodeValue();
      if (thisProduct_id.equals(product_id)) {
          if (i != 0) {
              prev_id = products.item(i-1)
                           .getChildNodes().item(0).getNodeValue();
          } else {
              prev_id = products.item(num_products-1)
                            .getChildNodes().item(0).getNodeValue();
          }
 
          if (i != (num_products-1)) {
              next_id = 
products.item(i+1).getChildNodes().item(0).getNodeValue();
          } else {
              next_id = 
             products.item(0).getChildNodes().item(0).getNodeValue();
          }
          transformer.setParameter("vProduct_id", product_id);
          transformer.setParameter("vPrev_id", prev_id);
          transformer.setParameter("vNext_id", next_id);
          transformer.transform(new StreamSource(XMLFileName), 
                        new StreamResult(output));
       }
      }
     } catch (Exception e) {
          output.print("Problem transforming the file.");
     }
   }
}
Ho installato come diceva il manuale xalan e definito il classpath
correttamente.
Se compilo il prg non mi da errore, se invece lo eseguo  mi dice
questo:
The server encountered an internal error (Internal Server Error) that
prevented it from fulfilling this request.
exception 
javax.servlet.ServletException: Cannot allocate servlet instance for
path /servlet/TransformServlet
	at
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:415)
	at
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
	at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
	at java.lang.Thread.run(Thread.java:484)
root cause 
java.lang.NoClassDefFoundError: javax/xml/transform/Source
	at java.lang.Class.newInstance0(Native Method)
	at java.lang.Class.newInstance(Class.java:237)
	at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:820)
	at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:615)
	at
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:396)
	at
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
	at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
	at java.lang.Thread.run(Thread.java:484)
Avete un'idea di cosa devo fare?
Se volessi utilizzare le api xml di java 1.4 su java 1.3 cosa devo
fare?
Grazie

Sul mio pc ho installato java 1.4 e tomcat 4.0.
[CUT]
Non so se ti sarò d'aiuto, ma ho un sospetto.
Che versione (precisa) di Tomcat usi?
Non sarà mica una LE?
Se sì, prova a usarne una "normale"...
-- 
Ciao
	Fabrizio C.

 java.lang.NoClassDefFoundError: javax/xml/transform/Source
Hai messo i jar che servono in
catalina_home\common\lib
oppure in
catalina_home\server\lib ?
Saluti