Created attachment 22845 [details] A diff against ANT_17_BRANCH XSLT processing tasks allows one to specify custom transformer factory, including a custom class path for this factory's classes. This is very handy as it allows custom XSLT processor to be embedded in the project. However, when used, it throws ClassNotFoundExceptions from TraXLiaison (1.6.x, 1.7.x, head). The bug is caused by the following snippet in TraXLiaison: private TransformerFactory getFactory() throws BuildException { // ... [SNIP] try { Class clazz = Class.forName(factoryName); tfactory = (TransformerFactory) clazz.newInstance(); } catch (Exception e) { // ... [SNIP] XSLT task sets a custom context class loader, but it is not used here, because Class.forName(String) is equivalent to calling: Class.forName(String, definingClass.getClassLoader()); In other words, ANT's class loader is used to look up the class where context class loader should be used (this is a common mistake). This can be fixed in a number of ways -- by using Class.forName(String, Thread.currentThread().getContextClassLoader()) or by using the context class loader explicitly (as in the attached patch).
*** Bug 41314 has been marked as a duplicate of this bug. ***
*** Bug 29596 has been marked as a duplicate of this bug. ***
svn revision 720773 uses the thread context classloader but falls back to Class.forName with no args if the factory cannot be found in the thread context loader.