How to run Spring 3.0 PetClinic in tomcat with Hibernate backed JPA
Ok, here is what I did:
- Get Tomcat 6.0.26
Checkout the petclinic sample:
svn co https://src.springframework.org/svn/spring-samples/petclinic/trunk/ petclinic
cd
into the petclinic directory- Modify
src/main/webapp/WEB-INF/spring/applicationContext-jpa.xml
to use Hibernate:- COMMENT the
<context:load-time-weaver>
(load-time weaver SHOULD NOT be used with Hibernate, this is for Toplink) - Declare Hibernate as
jpaVendorAdapter
(comment the Toplink part, uncomment the Hibernate part)
- COMMENT the
- Modify the
src/main/webapp/WEB-INF/web.xml
to use theapplicationContext-jpa.xml
Modify the
pom.xml
to bundle jta.jar in the war (as pointed out by @skaffman):<dependency> <groupId>javax.transaction</groupId> <artifactId>com.springsource.javax.transaction</artifactId> <version>1.1.0</version> <!--scope>test</scope--></dependency>
Build the war
mvn install
Deploy it to Tomcat
cp target/petclinic.war $TOMCAT_HOME/webapps
Browse
http://localhost:8080/petclinic
Looks like a problem with PetClinic packaging:
http://forum.springsource.org/showthread.php?t=85042
and
http://jira.springframework.org/browse/SPR-6880
There's fix in there for the pom.xml