<style> does not appear to use the classpath attribute for locating xalan classes. my ant tag: <target name="trans-source" depends="init"> <style basedir="${src.dir}/msg" in="${src.dir}/msg/request/LoginRequest.xml" out="${src.dir}/com/converging/Beans/LoginRequestBean.java" style="${src.dir}/msg/msgBean.xsl" processor="xalan"> <classpath> <pathelement location="lib/xalan.jar" /> <pathelement location="lib/xerces.jar" /> <pathelement location="lib/xalanj1compat.jar" /> <pathelement location="src/msg" /> </classpath> </style> ######my output: trans-source: Class org.apache.tools.ant.taskdefs.optional.XalanLiaison loaded from parent loa der BUILD FAILED java.lang.NoClassDefFoundError: org/apache/xalan/xslt/XSLTProcessorFactory at org.apache.tools.ant.taskdefs.optional.XalanLiaison.<init>(XalanLiais on.java:82) at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java:237) at org.apache.tools.ant.taskdefs.XSLTProcess.resolveProcessor(XSLTProces s.java:278) at org.apache.tools.ant.taskdefs.XSLTProcess.getLiaison(XSLTProcess.java :394) at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:14 1) at org.apache.tools.ant.Task.perform(Task.java:217) at org.apache.tools.ant.Target.execute(Target.java:164) at org.apache.tools.ant.Target.performTasks(Target.java:182) at org.apache.tools.ant.Project.executeTarget(Project.java:601) at org.apache.tools.ant.Project.executeTargets(Project.java:560) at org.apache.tools.ant.Main.runBuild(Main.java:454) at org.apache.tools.ant.Main.start(Main.java:153) at org.apache.tools.ant.Main.main(Main.java:176) Total time: 4 seconds org/apache/xalan/xslt/XSLTProcessorFactory #####But from the same directory: javap -classpath lib\xalanj1compat.jar org.apache.xalan.xslt.XSLTProcessorFactory Compiled from XSLTProcessorFactory.java public class org.apache.xalan.xslt.XSLTProcessorFactory extends java.lang.Object { public org.apache.xalan.xslt.XSLTProcessorFactory(); public static org.apache.xalan.xslt.XSLTProcessor getProcessor() throws org. xml.sax.SAXException; public static org.apache.xalan.xslt.XSLTProcessor getProcessor(org.apache.xa lan.xpath.xml.XMLParserLiaison); public static org.apache.xalan.xslt.XSLTProcessor getProcessor(org.apache.xa lan.xpath.xml.XMLParserLiaison, org.apache.xpath.XPathFactory); public static org.apache.xalan.xslt.XSLTProcessor getProcessorUsingLiaisonNa me(java.lang.String) throws org.xml.sax.SAXException; }
The problem is that optional.jar is in the system classpath, thus XalanLiaison will be loaded from the system classloader, which doesn't know anything about the classpath you have specified. The only solution for you is to remove optional.jar from ANT_HOME/lib and add an entry for it to the classpath of your <style> task. I'm afraid this cannot be fixed (at least not in the context of Ant 1.x).
reopen to mark as duplicate of new META BUG
*** This bug has been marked as a duplicate of 6606 ***