Hi all, This problem lies in the nexus of xalan and ant. The problem may lie in how ant (or our build scripts) use xalan.
The context: ============= -our ant build scripts call a few stylesheets that use custom extensions (i.e. with xalan) -these have always worked before with ant 1.7.0 and xalan 2.7.0 -our ant .sh/.bat scripts set the following properties to force xalan ANT_OPTS="-XX:MaxPermSize=128m -Xms256m -Xmx512m -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl" - in the previous ant version (1.7.0)we put all our xalan* jars in $ANT_HOME/lib (xalan.jar, xercesImpl.jar, serializer.jar) this worked -we still have xalan.jar, xerces.jar, etc. in $ANT_HOME/lib -We actually had two problems ("A and B") with xalan extension (in two different ant targets & stylesheets ). -Problem A complained about my method 'not static' -Problem B is below "java.lang.NoSuchMethodException: For extension function, could not find method "org.apache.xml.dtm.ref.DTMNodeIterator.formatUnicode" (whereas my 'formatUnicode' method actually belongs to a different class) -After reading up, I used the endorsed dir mechanism ("-Djava.endorsed.dirs=tmpfoo.endorsed, i.e. working directory to get around the problem) This solved problem A. -Endorsed directory tmpfoo.endorsed contains: serializer.jar xalan.jar xercesImpl.jar xml-apis.jar -Problem B remains The question ============== * does the extension declaration and use look wrong? * why would it have worked in ant 1.7.0 and failed in 1.8.1 when the same version of xalan? * insights as to the cause and the solution? thanks in advance, (data below) will Error Message ================= lit-compile: [xslt] Transforming into /home/myhome/projects/pe_mainline4/pe/derived/literals [xslt] Processing /home/myhome/projects/pe_mainline4/pe/derived/literals/xml/literals.xml to /home/myhome/projects/pe_mainline4/pe/derived/literals/literals.log [xslt] Loading stylesheet /home/myhome/projects/pe_mainline4/pe/src/xsl/literals/gen_java.xsl [xslt] /home/myhome/projects/pe_mainline4/pe/src/xsl/literals/gen_java.xsl:84:41: Fatal Error! java.lang.NoSuchMethodException: For extension function, could not find method org.apache.xml.dtm.ref.DTMNodeIterator.formatUnicode([ExpressionContext,] ). Cause: java.lang.NoSuchMethodException: For extension function, could not find method org.apache.xml.dtm.ref.DTMNodeIterator.formatUnicode([ExpressionContext,] ). [xslt] /home/myhome/projects/pe_mainline4/pe/src/xsl/literals/gen_java.xsl:0:0: Fatal Error! Fatal error during transformation Cause: Fatal error during transformation [xslt] Failed to process null Declaration of Extension ================== Here are our extension functions: declaration: <xsl:stylesheet version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" xmlns:redirect="http://xml.apache.org/xalan/redirect" xmlns:escape="com.company.util.xml.UnicodeEncodeUtil" extension-element-prefixes="redirect escape" > Usage of Extension ============== <xsl:variable name="text3"> <xsl:call-template name="replace-string"> <xsl:with-param name="text" select="$text2"/> <xsl:with-param name="from" select="' '"/> <xsl:with-param name="to" select="'\n'"/> </xsl:call-template> </xsl:variable> * <xsl:value-of select="escape:formatUnicode($text3)"/>* Environment ========== <?xml version="1.0" encoding="UTF-8"?><out> <checkEnvironmentExtension> <EnvironmentCheck version="$Revision$"> <environment> <item key="version.DOM.draftlevel">2.0fd</item> <item key="java.class.path">/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-launcher.jar:/opt/sun-j2ee-1.3.1/lib/j2ee.jar:/home/myhome/projects/pe_mainline4/pe/./:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-antlr.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-apache-bcel.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-apache-bsf.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-apache-log4j.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-apache-oro.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-apache-regexp.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-apache-resolver.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-apache-xalan2.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-commons-logging.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-commons-net.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-jai.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-javamail.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-jdepend.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-jmf.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-jsch.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-junit.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-launcher.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-netrexx.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-nodeps.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-swing.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-testutil.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/ant-contrib-1.0b3.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/groovy-all-1.7.0.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/oracle_ojdbc14.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/serializer.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/sqljdbc.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/xalan.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/xercesImpl.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/YUIAnt.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/yuicompressor-2.4.1.jar:/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/xml-apis.jar:/usr/local/sun-jdk-1.6.0.20/lib/tools.jar</item> <item key="version.JAXP">1.1 or higher</item> <item key="java.ext.dirs">/usr/local/sun-jdk-1.6.0.20/jre/lib/ext:/usr/java/packages/lib/ext</item> <foundJar desc="apparent.version" name="serializer.jar">serializer.jar present-unknown-version</foundJar> <foundJar desc="path" name="serializer.jar">/home/myhome/projects/pe_mainline4/pe/tmpfoo.endorsed/serializer.jar</foundJar> <foundJar desc="path" name="xalan.jar">/home/myhome/projects/pe_mainline4/pe/tmpfoo.endorsed/xalan.jar</foundJar> <foundJar desc="apparent.version" name="xercesImpl.jar">xercesImpl.jar WARNING.present-unknown-version</foundJar> <foundJar desc="path" name="xercesImpl.jar">/home/myhome/projects/pe_mainline4/pe/tmpfoo.endorsed/xercesImpl.jar</foundJar> <foundJar desc="apis.jar-apparent.version" name="xml">xml-apis.jar present-unknown-version</foundJar> <foundJar desc="apis.jar-path" name="xml">/home/myhome/projects/pe_mainline4/pe/tmpfoo.endorsed/xml-apis.jar</foundJar> <item key="version.xerces2">Xerces-J 2.9.0</item> <item key="version.xerces1">not-present</item> <item key="version.xalan2_2">Xalan Java 2.7.1</item> <item key="version.xalan1">not-present</item> <item key="version.ant">Apache Ant version 1.8.1 compiled on April 30 2010</item> <item key="java.version">1.6.0_20</item> <item key="version.DOM">2.0</item> <item key="version.crimson">present-unknown-version</item> <item key="sun.boot.class.path">tmpfoo.endorsed/serializer.jar:tmpfoo.endorsed/xalan.jar:tmpfoo.endorsed/xercesImpl.jar:tmpfoo.endorsed/xml-apis.jar:/usr/local/sun-jdk-1.6.0.20/jre/lib/resources.jar:/usr/local/sun-jdk-1.6.0.20/jre/lib/rt.jar:/usr/local/sun-jdk-1.6.0.20/jre/lib/sunrsasign.jar:/usr/local/sun-jdk-1.6.0.20/jre/lib/jsse.jar:/usr/local/sun-jdk-1.6.0.20/jre/lib/jce.jar:/usr/local/sun-jdk-1.6.0.20/jre/lib/charsets.jar:/usr/local/sun-jdk-1.6.0.20/jre/classes</item> <foundJar desc="apparent.version" name="serializer.jar">serializer.jar present-unknown-version</foundJar> <foundJar desc="path" name="serializer.jar">/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/serializer.jar</foundJar> <foundJar desc="path" name="xalan.jar">/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/xalan.jar</foundJar> <foundJar desc="apparent.version" name="xercesImpl.jar">xercesImpl.jar WARNING.present-unknown-version</foundJar> <foundJar desc="path" name="xercesImpl.jar">/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/xercesImpl.jar</foundJar> <foundJar desc="apis.jar-apparent.version" name="xml">xml-apis.jar present-unknown-version</foundJar> <foundJar desc="apis.jar-path" name="xml">/home/myhome/projects/devtools/apache-ant/apache-ant-1.8.1/lib/xml-apis.jar</foundJar> <item key="version.SAX">2.0</item> <item key="version.xalan2x">Xalan Java 2.7.1</item> </environment> <status result="OK"/> </EnvironmentCheck> </checkEnvironmentExtension> </out>