Changeset 22390

13.07.2010 17:08:22 (10 years ago)

Gone back to the old way of forcing use of xalan's TransformerFactory? for generating a new instance of the factory, since we don't want to accidentally use some other TransformerFactory? that might be on the classpath as could happen the way the code had recently been changed. Setting the System property to xalan's TransformerFactory?, however, was a problem with running fedora which does not include xalan.jar and serializer.jar (and possibly necessary xsltc.jar). But now, by following Katherine's suggestion to include these jar files in packages/tomcat/lib, Fedora is finding them and the server working continuously.

1 modified


  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/

    r22370 r22390  
    7474   */ 
    7575    public XMLTransformer() { 
    76     // make sure we are using the xalan transformer 
    7876    // states that 
    7977    // TransformerFactory.newInstance() looks in jar files for a Factory specified in META-INF/services/javax.xml.transform.TransformerFactory,  
    8482    // This means we no longer have to do a System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl"); 
    8583    // followed by a this.t_factory = org.apache.xalan.processor.TransformerFactoryImpl.newInstance(); 
    86     // The System.setProperty step to force the TransformerFactory implementation that gets used conflicts with 
     84    // The System.setProperty step to force the TransformerFactory implementation that gets used, conflicts with 
    8785    // Fedora (visiting the Greenstone server pages breaks the Greenstone-tomcat hosted Fedora pages) as Fedora  
    8886    // does not include the xalan.jar and therefore can't then find the xalan TransformerFactory explicitly set. 
     88    // Gone back to forcing use of xalan transformer, since other jars like crimson.jar, which may be on some 
     89    // classpaths, could be be chosen as the TransformerFactory implementation over xalan. This is what used to 
     90    // give problems before. Instead, have placed copies of the jars that Fedora needs (xalan.jar and serializer.jar  
     91    // and the related xsltc.jar which it may need) into packages/tomcat/lib so that it's on the server's classpath 
     92    // and will be found by Fedora. 
     94    // make sure we are using the xalan transformer 
     95    System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl"); 
    9096    try { 
    91         this.t_factory = TransformerFactory.newInstance(); 
     97        this.t_factory = org.apache.xalan.processor.TransformerFactoryImpl.newInstance(); 
     98        //this.t_factory = TransformerFactory.newInstance(); 
    9299    } catch (Exception e) { 
    93100        logger.error("exception "+e.getMessage());