Tallan Blog

Tallan’s Experts Share Their Knowledge on Technology, Trends and Solutions to Business Challenges

Java Spring Application on Azure Cloud

Microsoft states to developers using  Azure that one can build applications using any language, tool or framework.  This blog post will show you how to deploy a Spring application on an Azure cloud.  Our first step will be to install a Jetty instance on to the cloud, and then we’ll import jars and do any necessary fine tuning to get our sample spring application on the cloud.

There’s a great blog post to get you started with getting a Jetty instance on the cloud that I want to refer you to: http://blogs.msdn.com/b/dachou/archive/2010/03/21/run-java-with-jetty-in-windows-azure.aspx

Next download a sample spring application.  I was able to get one at: https://src.springframework.org/svn/spring-samples/petclinic/trunk/ [Dead Link]

The presence of a pom.xml file in the root directory tells us that the project can built using maven.  Install maven if you don’t have it, and then run an mvn clean install from the root directory.  That command will run all unit tests and build the solution.

If I recall, I had a little bit of difficulty with a couple of the tests.  I was able to comment out the failing tests, and the sample application ran fine for our purposes.  Once you get the spring application built, copy the *.war file to the web app dir of your jetty instance.  Startup your jetty instance locally and confirm that the spring app is working.

If the spring application works locally, the next step is to move it to the cloud

Rename your *.war to test.war so that it matches the war from the blog above.  Overwrite the war from above with your new war containing the spring application.  The hardest part about getting a spring application to load instead of just the jetty splash page from the original tutorial is getting your JSP jars in place.  To acquire the JSP jars that were needed I downloaded Jetty 7.4.5.v20110725, and copied the jetty jsp folder (jetty-distribution-7.4.5.v20110725\lib\jsp) to JettyWorkerRole\app\jetty7\lib\jsp and with that your spring application is ready to be deployed to the cloud.

I had a lot of problems putting this tutorial together and generally wouldn’t recommend a java application on an Azure cloud.  There was tremendous difficulty debugging, because you can’t access the console that was started by the worker role.  When issues arise, I would just get blank screens in my web browser, and I had to assume (correctly, though I didn’t know it at the time) the issue was related to jsp jars missing.

Learn more about Tallan or see us in person at one of our many Events!

Share this post:

6 Comments. Leave new

SharePoint Experts India Blog
April 3, 2012 7:35 am

Great find, I’m going to have to check this one out. Thanks for sharing.
Very informative….

Have you thought about adding some videos to your article? I think it might enhance everyones understanding.

Odd , this page turns up with a dark color to it, what color is the primary color on your webpage?

It appears to me that this web site doesnt load in a Motorola Droid. Are other people getting the exact same problem? I enjoy this website and dont want to have to miss it whenever Im gone from my computer.

Richard Krajunus
May 7, 2012 9:59 pm

The banner is primarily a dark color, while the rest of the page has a white background. I hope that helps! Thanks for reading, Rich

Richard Krajunus
May 7, 2012 10:05 pm

I never thought about adding videos. Truthfully, this is my first attempt at blogging about anything, and I didn’t know how widely it would be followed. In the meantime, I’d be interested to hear about what parts you found confusing; maybe I could provide clarification?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>