ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Tronçon <re...@el-tramo.be>
Subject JAXP & Classloading
Date Fri, 05 Mar 2010 13:11:49 GMT
Hi,

I have the following task:
  import org.apache.tools.ant.Task;
  import javax.xml.parsers.SAXParserFactory;

  public class FooTask extends Task {
    public void execute() {
      System.setProperty("javax.xml.parsers.SAXParserFactory",
getClass().getCanonicalName());
      SAXParserFactory f = SAXParserFactory.newInstance();
    }
  }

and a build file containing the following:
    <taskdef name="foo" classname="FooTask" classpath="."/>
    <foo/>

When I run the foo task, I get the following error:
   javax.xml.parsers.FactoryConfigurationError: Provider FooTask not found

However, when I run with "-lib ." everything runs as expected.

This feels like a problem with the classloader not being able to load
the class specified in the string (maybe related to the JUnit problem
in the FAQ perhaps?). What is the best way to solve this problem
elegantly? (i.e. how do I make sure that JAXP finds my class?).

I'm using ant 1.7.

thanks,
Remko

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message