Add Spring Capabilities...
Add Hibernate Capabilities...

public class Knight {
public String name;
public String getName() {
return name;
public void setName(String name) { = name;
public String toString(){
return "My name is "+getName();

<bean id="Knight" class="com.wos.test.Knight">
<property name="name">

BeanFactory factory = new XmlBeanFactory(new FileSystemResource(new File("src\\applicationContext.xml")));
Knight k = (Knight) factory.getBean("Knight");

Gotcha number 1:
java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
Problem: No commons-pool-1.2.jar

Add this to WEB-INF/lib/

Gotcha number 2:
To the test app & add a file to get rid of the log4j warnings.


My name is JoJo


Ok, now we add Hibernate..

hmm, error that it can't find net.sf.HibernateException
odd considering that we're using hibernate3, which should look like org.hibernate...

adding hibernate2.jar to the /lib... and we're past that one.

Now it's:
PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy0] to required type [net.sf.hibernate.SessionFactory] for property 'sessionFactory']

Looks sketchily like another hibernate 2 v 3 problem to me. does spring perhaps not support hibernate 3? Worth checking...

hah!!!!! spring "not support hibernate"?? what a joke. Spring is a super star. The problem is MyEclipse. It brings in such a hunk of jar's that it turns out you can get one's that reference different version of hibernate. I think I'll be adding jars myself from now on.

Now it's all set. And if AbstractTransactionalDataSourceSpringContextTests isn't the end all expression of Rod Johnson's love for the common man, I don't know what is.

Just remember to use:

on your datasource, or you could end up doing a bit more comitting than you meant to ;)