Tuesday, November 18, 2008

The webapp -- starting the engine

I plan to create a simple webapp and illustrate using maven, hibernate, jpa, spring mvc, spring security, spring webflow etc.
And at the last point add Terracotta and see how easy it is to cluster a webapp and scale out.

Basically most of the stuffs that I am going to post here are things that I learnt when building http://reference.terracotta.org/examinator.
Yes the Examinator is live. And now you can play around with it.
You can find out more about it here.

I do not plan to rewrite the whole Examinator here, but show the glue points of making those cool technologies together.

Lets get going...

First we need a project. I am going to use the webapp-archetype to generate a skeleton for our project.
Using the quickstart guide, I changed the groupId and the artifactId to generate a project for myself like this:

mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \
-DarchetypeGroupId=org.terracotta.maven.archetypes \
-DarchetypeArtifactId=webapp-archetype \
-DarchetypeVersion=1.2.1 \
-DgroupId=org.sanoujam \
-DartifactId=sample-tc-webapp \
-Dversion=1.0.0 \
-DremoteRepositories=http://www.terracotta.org/download/reflector/maven2

This created a project for me called sample-tc-webapp and generated a working project skeleton for me.

If you want, you can verify its running by:

cd sample-tc-webapp
mvn tc:run

This will bring up two tomcat nodes on your localhost. Accessing http://localhost:8080/sample-tc-webapp should show you a working web-app which is clustered with Terracotta. The other tomcat is running at http://localhost:8081/sample-tc-webapp


You can find the source code of this project at http://code.google.com/p/sample-tc-webapp/
The source can be browsed at http://sample-tc-webapp.googlecode.com/svn/tags/day1/

Stopping here for today...
Lets see if we can add Spring next time....

No comments:

Post a Comment