Sunday, March 23, 2014

JTA Tutorial

Following http://www.javacodegeeks.com/2013/07/spring-jta-multiple-resource-transactions-in-tomcat-with-atomikos-example.html

Installed MySQL and manually created the two databases/tables
When importing downloaded maven project to Eclipse Kepler (JEE) got error. Resolved using http://qussay.com/2013/09/13/solving-dynamic-web-module-3-0-requires-java-1-6-or-newer-in-maven-projects/ (need to right click project and do Maven Update Project.) Note: I also checked "Dynamic Web Module" under Project Facets

Added a run configuration with goal "package" per "Cimbom" - http://stackoverflow.com/questions/9665569/where-did-eclipses-run-as-maven-package-go - need to ensure JRE tab is set to JRE of 1.7 (or else get error: "javac: invalid flag: -s" --probably cuz I had workbench default JRE set to 1.5 duh.)
Ran it it produced springexample.war in target folder root.

Click Servers tab and add Tomcat 7, selected it and click start button. That loads the webapp but doesn't create a springexample under Apache not sure why. would need to start Apache manually (from bin dir) and copy the above war file to webapps.
Load localhost:8080/springexample/appServlet and confirm get "Both employees are inserted!" Verify items are added in MySQL Workbench. Test Rollback scenario per article.


No comments:

Post a Comment