Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    1,202

    [ JSP ] No more input

    Ciao, sto cercando di fare una semplice trasformazione XSL usando saxon e la libreria javax.xml, ma ottengo questo errore:
    codice:
    root cause
    
    javax.xml.transform.TransformerConfigurationException: java.io.EOFException: no more input
    Come se non leggesse i file, ma i file ci sono e i permessi sembrano a posto... quando avevo usato saxon con le librerie jdom infatti aveva funzionato. Ora devo usare queste altre perchè mi serve xalan per il passaggio di parametri al foglio xsl.

    Le policy
    codice:
      permission java.io.FilePermission "/tmp/*", "read,write";
      permission java.util.PropertyPermission "user.dir", "read";
    
      permission java.util.PropertyPermission "javax.xml.transform.TransformerFactory", "write";
    e il sorgente jsp:
    codice:
    <%@ page import="java.io.*, javax.xml.transform.*,  javax.xml.transform.stream.*" %>
    
    <%
    
    final String XMLPATH = "/tmp/db.xml";
    final String XSLPATH = "/tmp/stile.xsl";
    final String HTMPATH = "/tmp/menu.htm";
    StreamSource xmlSource = new StreamSource(XMLPATH);
    StreamSource xslSource = new StreamSource(XSLPATH);
    FileOutputStream fos = new FileOutputStream(HTMPATH);
    StreamResult htmResult = new StreamResult(fos);
    
    synchronized(this){
    
    	System.setProperty( "javax.xml.transform.TransformerFactory", 
    "com.icl.saxon.TransformerFactoryImpl"); 
    	TransformerFactory tFactory = TransformerFactory.newInstance();
    
    	Transformer transformer = tFactory.newTransformer(xslSource);
    
    	transformer.transform(xmlSource, htmResult);
    }
    
    %>
    
    <div id="menu">
    	<jsp:include page="/tmp/menu.htm" />
    </div>
    Uso Java 5, Tomcat 4 e Saxon 6.x

    Se al posto di Saxon provo ad usare xalan stesso, in questo modo:
    codice:
    	System.setProperty( "javax.xml.transform.TransformerFactory", 
    "org.apache.xalan.transformer.TransformerImpl");
    Ottengo invece questo errore
    codice:
    root cause
    
    javax.xml.transform.TransformerFactoryConfigurationError:
     Provider org.apache.xalan.transformer.TransformerImpl could not be instantiated: 
    java.lang.InstantiationException: org.apache.xalan.transformer.TransformerImpl
    	at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
    E non capisco perchè non riesca ad instanziarlo.

    Aiuto
    Debian GNU/Linux sid
    Publishing a theory should not be the end of one's conversation with the universe, but the beginning. (Eric S. Raymond)
    Kernel 2.6.14-ck1

  2. #2
    Utente di HTML.it
    Registrato dal
    Feb 2002
    Messaggi
    1,202
    Ho risolto, era
    codice:
    	System.setProperty( "javax.xml.transform.TransformerFactory",
     "org.apache.xalan.processor.TransformerFactoryImpl");
    Debian GNU/Linux sid
    Publishing a theory should not be the end of one's conversation with the universe, but the beginning. (Eric S. Raymond)
    Kernel 2.6.14-ck1

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.