OK, this probably is supposed to be the easiest thing in the world, but I've been trying for the entire day, and it's still not working.. Any help is highly appreciated!
EDIT: For the correct procedure, please see Pascal's answer.
My wrong (since I did not disabled LoadTimeWeaving) procedure is left for reference..:
What I did:
- Downloaded Tomcat 6.0.26 & Spring 3.0.1
- Downloaded PetClinic from https://src.springframework.org/svn/spring-samples/petclinic
- Built & deployed petclinic.war. Ran fine with default JDBC persistence.
- Edited webapps/WEB-INF/spring/applicationContext-jpa.xml and set
jpaVendorAdaptor
to Hibernate. - Edited webapps/WEB-INF/web.xml and changed
context-param
from applicationContext-jdbc.xml to applicationContext-jpa.xml - Copied everything in the Spring 3.0.1 distribution to TOMCAT_HOME/lib.
Launched tomcat. Saw
Caused by: java.lang.IllegalStateException: ClassLoader [org.apache.catalina.loader.WebappClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:spring-agent.jar
Uncommented line
<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/>
in webapps/META-INF/context.xml.- Same error. Added that line to TOMCAT_HOME/context.xml
Deployed without error. However, when I do something it will issue an error saying
java.lang.NoClassDefFoundError: javax/transaction/SystemException at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:39)
11.Changed scope of javax.transaction from test to default (just deleted test), as suggested by scaffman.
12.Runs fine!! Thank you!