# classpath problem

**URL:** https://forum.liquibase.org/t/classpath-problem/765
**Category:** General Discussion
**Created:** [August 23, 2010, 1:22pm UTC](https://forum.liquibase.org/t/classpath-problem/765 "2010-08-23T13:22:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vsevolod.vlasov](https://avatars.discourse-cdn.com/v4/letter/v/c68b51/32.png) [@vsevolod.vlasov](https://forum.liquibase.org/u/vsevolod.vlasov)
#### Post date: [August 23, 2010, 1:22pm UTC](https://forum.liquibase.org/t/classpath-problem/765/1 "2010-08-23T13:22:00Z")

</div>

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:

&nbsp; &nbsp;   
&nbsp; &nbsp; &nbsp; &nbsp;   
&nbsp; &nbsp;

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

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…

---

<div class="post-metadata">

### Author: ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)
#### Post date: [August 23, 2010, 1:22pm UTC](https://forum.liquibase.org/t/classpath-problem/765/2 "2010-08-23T13:22:00Z")

</div>

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

Classloaders get weird, in my opinion,especially in ant 🙂  
Liquibase creates its own classloader for loading the hibernate config, jdbc drivers, etc.&nbsp; 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
