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

点点圈 提交于 2019-11-27 23:51:00

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:
  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):

    <dependency>
      <groupId>javax.transaction</groupId>
      <artifactId>com.springsource.javax.transaction</artifactId>
      <version>1.1.0</version>
      <!--scope>test</scope-->
    </dependency>
    
  7. Build the war

    mvn install
    
  8. Deploy it to Tomcat

    cp target/petclinic.war $TOMCAT_HOME/webapps
    
  9. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!