How to run Spring 3.0 PetClinic in tomcat with Hibernate backed JPA

后端 未结 2 889
栀梦
栀梦 2020-12-06 12:09

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!

2条回答
  •  爱一瞬间的悲伤
    2020-12-06 12:36

    Ok, here is what I did:

    1. Get Tomcat 6.0.26
    2. Checkout the petclinic sample:

      svn co https://src.springframework.org/svn/spring-samples/petclinic/trunk/ petclinic
      
    3. cd into the petclinic directory

    4. Modify src/main/webapp/WEB-INF/spring/applicationContext-jpa.xml to use Hibernate:
      • COMMENT the (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)
    5. Modify the src/main/webapp/WEB-INF/web.xml to use the applicationContext-jpa.xml
    6. Modify the pom.xml to bundle jta.jar in the war (as pointed out by @skaffman):

      
        javax.transaction
        com.springsource.javax.transaction
        1.1.0
        
      
      
    7. Build the war

      mvn install
      
    8. Deploy it to Tomcat

      cp target/petclinic.war $TOMCAT_HOME/webapps
      
    9. Browse

      http://localhost:8080/petclinic
      

提交回复
热议问题