Java in the Cloud

By Hari K. Gottipati
December 19, 2008 | Comments: 16

No one is talking about the Web 2.0, AJAX, SaaS, or SOA these days. It doesn't mean that no one is using these technologies, it is just that these are not the buzzwords anymore. The latest buzzword is "Cloud Computing". Every one is talking about building apps in cloud or moving the apps to cloud. There are plenty of jobs on job boards looking for the people with the skills: "familiarity with cloud" or "expertise in cloud".

What is the cloud?

Every one defines the cloud in their own way, here is my take on it. Companies whose main business is not Computer related, they outsource their IT work to some computer consulting firm. It is because IT is not their main business and some times it makes sense to hand it over. Similarly, for application development companies - the focus is application development, not hosting the applications. In addition to the application developers, they need to have IT people, hardware to host the apps. For some companies it makes sense to outsource the IT and hardware. In other words, you are outsourcing your application to a different company. Application outsourcing used to be to hosting companies, but that's changing to the cloud due to its infrastructure. The cloud makes it very easy to scale an app for rapid growth compared to the hosting companies. Cloud will take away all the hardware management and IT risks from you.

book coverbook cover
For a complete list of Rough Cuts,

Why all of sudden?

Cloud is not new. Standard apps such as your personal email(Gmail, Yahoo Mail, and Live Mail etc) has always been there on the servers in the cloud. Lots of companies are moving away from in-house Exchange/Lotus Notes servers and outsourcing their mail to mail hosting companies. Slowly, the paradigm shifted from desktops apps to intranet hosted apps to SaaS (Software as a Service). Third party apps such as time tracking, project management, office, CRM, e-commerce became subscription based services. In other words, you don't have to install and manage these apps in-house, instead the service provider will manage these for you for a subscription fee. Now the paradigm shift is, moving the custom apps into third party infrastructure for a subscription fee. The "Cloud" buzz started when Amazon introduced EC2 and picked up there after by Google's App Engine and Microsoft's Azure. Since these companies use the high end sophisticated infrastructure with the help of virtualization software to run their apps and with the promise of running your app in the same infrastructure, boosted lots of companies to move their apps to the cloud.

Infrastructure as a Service (IaaS) vs Platform as a Service (PaaS)

IaaS clouds provides resources such as servers, connections, storage, and tools necessary to build an application environment from scratch. PaaS clouds are often within IaaS Clouds and provides required software, tools to support the complete life cycle of building and deploying the applications. Amazon EC2 is the truly an IaaS provider, as it provides the infrastructure, not the platform. Google App Engine, Microsoft Azure,, and Heroku are PaaS providers, as they provide the platform backed by the infrastructure.

Cloud providers

With Amazon EC2, you can install any thing you want in your virtual machines. EC2 gives you lots of control, but you still need to install OS, Web server, Web or Application container, Database and the whole nine yards that you do today for application deployment. It provides a virtual machine, and you are responsible for managing every thing inside the VM. This is very flexible along with the risk of managing everything. Best suited for Java in the cloud.

I believe Sun is going to be in the race because their Grid Compute Utility site is in transition with the message " is in transition as we add some exciting new options. We're not ready to show off what we're working on just yet, but we'd like to hear from you, and we'd like to keep in touch". It makes sense because they know hardware, they own Solaris OS, they have Java and they acquired MySQL recently.

With Google App Engine, you don't have any virtual machine and you are not responsible for installing/managing OS, software, database. Right now you are restricted to use Python to code the app and you need to use DataStore (persistent service) to get/put the data. You are responsible for developing and deploying the application. You also get the access to Google accounts, Gmail etc. No OS, server, database headaches with the disadvantage of being restricted to the Python and DataStore. It's not for Java apps right now, but they may support more languages in the future. Google seems to be more interested in Python than Java. Sun also embraced Python by hiring two of the main Python developers to work on Jython, which allows you to run Python on the JVM. Though these two are interrelated, hope Google will bring Java to app engine - if not at least Jython.

Microsoft Azure is purely for Microsoft related technologies. Azure is the development, hosting, and management environment with tools for Microsoft Visual Studio to enable the creation, building, debugging, running, and packaging of scalable services. It is not for Java, period. is for CRM applications and restricted to proprietary Apex language and Visualforce(presentation layer). Note: is a Softwae as a Service(SaaS) and is a PaaS for CRM app. Business ByDesign from SAP is just SaaS.

Heroku is restricted to Ruby on Rails backed by Amazon EC2.

I could be missing some other providers, but given all these - only Amazon EC2 supports Java in the cloud. However, it is an IaaS, not a PaaS. But we need a PaaS provider in order to focus on just Java development without worrying about managing the OS, Web server, Web or Application containers. A new startup named Stax can solve some of these issues to some extent.

PaaS provider for Java

Stax is a new startup which launched in beta this week to let the developers to focus on the Java application development. It is a PaaS for Java backed by Amazon EC2 infrastructure. Think of it like Google app engine for Java with the MySQL database. Being said, it is restricted to Java (I love this :-)) and makes Java development, deployment, scaling much faster and you can deploy the application in Amazon infrastructure, not in Stax infrastructure. Stax provides easy deployment of test and production environments, a local development model, and strong integration with existing development tools, frameworks, and processes. It provides built-in application templates for popular Java technologies including Struts, GWT, Wicket, JRuby on Rails, Jython - but not restricted to these. You can deploy any web app that runs in web container via Stax SDK. The local Stax run time is meant to be an easy-to-setup environment for running your applications and provides some tools for packaging and deploying them. The application templates are just a way to put together some common and/or interesting configurations to get developers going fast. Developers are free to add whatever binaries and configuration files into their applications before deploying them, including libraries not installed in the default application template. Stax will remain free during the beta. The company has not finalized plans for charging yet, but plan to offer some paid version of the service when it moves out of beta sometime next year. I believe the pricing will be designed to cover their AWS costs plus their costs.

Cloud features, limitations - what Stax can do?

Moving existing apps to Cloud

Running existing apps is dependent on how "cloud friendly" the application is. Stax isn't really competing to be a replacement for general application hosting, Stax is strongly focused on the idea of elastic applications where computing resources can be quickly changed to meet the needs of an application. This means that any given application instance may come or go at any time. This introduces a few stateless design constraints on applications, the 2 biggest being:

- applications can't rely on the local file system for persistence

- applications need to avoid relying on local server memory state (except for caching in
which case apps just need to be designed to restore the cache from a persistent location like DB if the cache experiences a miss)

This means many existing applications will be incompatible with the Stax environment, but Founder and CEO Spike Washburn feels "this elastic approach to programming is going to be required for apps as the use of elastic infrastructure increases in public clouds and private virtualized data centers".

Monitoring, reporting, debugging and support for Java apps in the cloud

Since it is the application developed by you, you don't need support for debugging. Cloud needs to provide the features designed to help developers gather information about their running servers, by offering features such as reporting/analytics and monitoring/alert APIs to make it much easier for developers to debug and understand the health of their applications and respond accordingly. Of course at some level, developers will always have to understand the internals of their own applications, and logs can be an invaluable part of debugging those kinds of issues. In a conversation with Mr. Washburn, he said that they are going to release monitoring/alert APIs soon and planning to provide other features and support.

Deploying on other Application servers

Stax is designed to provide a version of the Java web container (Tomcat) that is integrated with an elastic computing cloud. Stax goal is to help developers achieve a new level of application deployment flexibility which not only includes scaling apps up and down by deploying on elastic PaaS, but also giving developers the flexibility to take their applications and deploy them into their own application containers. In addition to supporting an end-to-end application life cycle, it provides the flexibility to use the system for only subsets of the life cycle too. For instance, at this point in the cloud adoption curve, some businesses are still reluctant to run their production apps in the cloud, but will consider it for dev/test purposes, so it is important for the apps to be able to run in 2 different environments (Stax for testing and optionally their own app server environment for production).

J2EE app with Application Container

At this time, Stax do not plan to offer support for choosing between application server implementations. Only Tomcat web container.

Spring, JBoss Seam, JSF and others

You can add any library as long as it runs inside the web container. Stax's initial set of application templates was more of an exercise in building a system to expose a hand full of pre-built application configurations that get developers rolling in a single click. Based on the beta feed back they are going to integrate with the new Java Module System and/or OSGi to make it easier for developers to create recipes for new application stacks.

If your application needs something other than Tomcat or your application needs access to local file system, then Stax is not for you. In these cases your only option is Amazon EC2 or wait for some other companies(Oracle, IBM?) to roll out the 'Java in the cloud' with your favorite app servers and/or access to local file system.

Do you know of any other Java cloud providers? If yes, please drop a line in the comments.

You might also be interested in:


Morph labs, also based on EC2. Seems very nice.

I would like to work with you on some RightScale Server Templates for the Java Developers. has a few Java templates to make EC2 Deployment easy, but a more detailed template would be a great addition to the project.

I work with them on many projects and when java is used I am in need of more in depth templates for actions like:

1) Code updates
2) Tomcat Operations Control Scripts.
3) Backup and restore of Content collected.
4) Log control for WAR based deployment.

If you could help I can do the RightScripts stuff. I just need more help with the new Java ideas.

Edward M. Goldberg

@JS, I looked at Morph Labs, seems very nice. They support PHP, Rails and Java. I am wondering whether Morph limits the web container to Tomcat or they have number of options for web/application containers?

@Edward M. Goldberg, Thanks for pointing to Seems there are lot of Java cloud providers out there.
Let me know how I can help, my email is harikrishnag(at)hotmail(dot)com.

Very nice article. As you correctly pointed out, cloud computing does solve a lot of headaches especially for early stage companies. And it is great to see many companies providing cloud infrastructure. Great explanation on Stax. I would like to try it out sometime..

@Navin, Edward M. Goldberg pointed to and it seems to be nice. They have dynamic auto scaling. With it you can dynamically scale the app horizontally or vertically based on the metrics, analytics(load) or based on the no. of messages in the queue. Very compelling feature.

Agreed with Navin - very clear and concise explanation of not only what cloud computing is, but how and where it can be beneficial not only to SME's but even the Goliaths are starting to see the benefits of the cloud. Thanks for this!

Take a look at Cloud Foundry:
It provides automated deployment and management of Java applications on EC2.

Also check out They have a cloud-based PLM suite that's built on Java.

"Monitoring, reporting, debugging and support for Java apps in the cloud"

Why use different API's and tooling in and out-side of the cloud when you can use the same metering/monitoring model irrespective of platform, environment and stage.

Applying Activity Based Costing to Cloud Applications (Twitter Mock)

A Unified Approach to Performance Management and Cost Management for Cloud Computing

@William - that's a good idea.

We looked over cloud providers and liked Flexiscale:

chiefly because of their pricing model- no set up fees no fixed costs and you can stop your application at any time, and thus stop spending money.

What we think is if we have a web 2.0 "hit" and our monetization scheme (way of making money from our hit) is not up to the task, we're not stuck watching our wonderful adventure in web 2.0 put us in debt for the rest of our natural lives as happy user after happy user downloads our application / service / song or whatever driving up our ISP bill with each mouse click.

Seems to us that that kind of thing ought to matter to businesses and their investors, staying in the black.

At least, if you're not a bank that is.

"This introduces a few stateless design constraints on applications, the 2 biggest being:

- applications can't rely on the local file system for persistence

- applications need to avoid relying on local server memory state (except for caching in
which case apps just need to be designed to restore the cache from a persistent location like DB if the cache experiences a miss) "

We realized that dealing with elastic scaling of JEE applications on the cloud would require a robust solution for data elasticity and robust in-memory data grid that could be used as the system of record.

In this way migrating existing JEE application can be made easier.

See more detailes on

Nati S.

Please update the article to reflect that Google App Engine now supports java. I would expect Oreilly not to link on July 22nd to an article from December 19th without updating such a critical part.


You may want to update this article now that Microsoft Windows Azure fully supports Java, as announced during the PDC09 conference. You can find more details there: including Java code samples, links to the Java SDK and Eclipse tools, etc.

Check the following URL: :-)

I deployed a Java web app developped with the Springframework (the PetClinic Sample) to the Windows Azure Platform.

First I switched the database engine from HSQLDB to "SQL Azure" (similar to SQLServer), then I used the TomcatWorkerRole developped by Infosys to deploy the Spring Web App ( and use the following Microsoft SQL Server JDBC Driver 2.0 ( to remotely access "SQL Azure" from the PetClinic web app.

Check my blog for more details :-)



News Topics

Recommended for You

Got a Question?