ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kev Jackson <>
Subject Re: Help with new ant task that uses spring
Date Tue, 13 Dec 2005 04:52:59 GMT

> My taskdef is as follows:
>        <taskdef name="authsum"
> classname="org.authsum.configuration.ant.taskdefs.AuthSumProperty">
>            <classpath>
>                <path refid="springframework.classpath"/>
>                <fileset file="../dbom/build/dbom.jar"/>
>                <fileset file="../services/build/services.jar"/>
>                    <!--  the configContext.xml file is in 
> ../services/src/conf -->
>                <dirset dir="../services/src/conf"/>
>                <!-- the following is to pick the log4j props -->
>                <dirset dir="../src/conf"/>
>                <fileset file="../anttask/build/anttask.jar"/>
>            </classpath>
>        </taskdef>     
> /home/rhodepc/configuration/tests/build.xml:97: 
> org.springframework.beans.factory.BeanDefinitionStoreException: 
> IOException parsing XML document from class path resource 
> [configContext.xml]; nested exception is 
> class path resource [configContext.xml] 
> cannot be opened because it does not exist

This is really more of a spring config issue than an ant issue from what 
I can see from the stack trace.  I remember Spring being quite awkward 
with respect to loading xml files from classpath, can you build a basic 
unit test like so:

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;

import junit.framework.TestCase;

public class BaseDAOTestCase extends TestCase {

    protected final Log log = LogFactory.getLog(getClass());
    protected final static ApplicationContext CTX;
    static {
        String[] paths = {"applicationContext.xml"};
        CTX = new ClassPathXmlApplicationContext(paths);

  public void testClasspath() {

basically this will remove ant completely from the equation and allow 
you to focus on why Spring cannot resolve the config file.

I have had problems in the past trying to run stuff like this from 
within eclipse (as it has it's own ideas of classpath), so make sure you 
do this from command line and make sure that CLASSPATH variable is not 
set first, hope this helps


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message