classpath problem

I’ve just spend a lot of time trying to figure out why am i getting HibernateException hibernate.cfg.xml not found all the time when running ant task.

Apparently when I run this task, it looks for hibernate.cfg.xml only in classpath configured in taskdef. See details below:

   
       
   

   
        <diffDatabaseToChangeLog classpathref=“classpath2”
                driver="${database.driver}" url="${database.url}" username="${database.username}" password="${database.password}"
                referenceurl=“hibernate:hibernate.cfg.xml”
                outputFile="${liquibase.dir}/changelog_${stamp}.xml"/>
   

This works only if hibernate.cfg.xml is accessible by classpath1.
At the same time I needed to provide classpathref in tag as well. But here it only needs liquibase library.
I guess classpath1 should be used only to find liquibase, while classpathref in tag should be used to find hibernate.cfg.xml.

Could you please clarify that to me?
Maybe I am doing something totally wrong…

(sorry for the slow response, I’ve been on vacation and since very far behind)

Classloaders get weird, in my opinion,especially in ant :slight_smile:
Liquibase creates its own classloader for loading the hibernate config, jdbc drivers, etc.  With 1.9, I think there were some issues with how we create the classloader from within ant that have been improved in 2.0.

Nathan