About Kai Waehner

Kai Waehner works as consultant. His main area of expertise lies within the fields of Java EE, SOA, Cloud Computing, BPM, Big Data, and Enterprise Architecture Management. He is speaker at international IT conferences such as JavaOne, ApacheCon or OOP, writes articles for professional journals, and shares his experiences with new technologies on his blog.

Rapid Cloud Development with Spring Roo – Part 2: VMware Cloud Foundry

Spring Roo is a tool to offer rapid application development on the Java platform. I already explained when to use it: http://www.kai-waehner.de/blog/2011/04/05/when-to-use-spring-roo. Spring Roo supports two solutions for Cloud Computing at the moment: Google App Engine (GAE) and VMware Cloud Foundry. Both provide the Platform as a Service (PaaS) concept. This article will discuss the Cloud Foundry support of Spring Roo. GAE was discussed in part 1 of this article series.

Deployment of a Cloud Foundry Application to the Cloud

The reference guide of Spring Roo gives an introduction at http://www.springsource.org/roo/guide?w=base-cloud-foundry, which describes the combination of Spring Roo and Cloud Foundry. In a nutshell, there is not much to do to deploy your (CRUD-) application in the Cloud Foundry cloud.
You have to login to your Cloud Foundry account, create a WAR file and deploy it. Three Roo commands execute these tasks. If you use any Cloud Foundry services (such as MySQL, Redis or RabbitMQ), then you have to create and bind these services using other Roo commands. The deployment is very easy. You can choose to deploy your application to a private cloud (your own servers) or to the public cloud (VMware servers).

I got a strange non-speaking exception (that’s a major problem of Spring Roo often): „Operation could not be completed: 400 Bad Request“, but no further details or exceptions. Forum support was necessary. The problem was that the name of my cloud app was already used by another developer, it was not unique (I tried to use the name „SimpleCloudFoundry“). A more speaking error message would be nice! Using another (unique) name solved the problem.

Cloud Foundry is just a traditional Web Application – Contrary to GAE

So, after reading the previous paragragh, the conlusion is the following: Spring Roo supports deploying its applications to the Cloud Foundry cloud. Thus, everything is fine? Yes, more or less surprisingly, that is true! The statement of the Cloud Foundry documentation is also true: „You won’t need to architect your applications in a special way or make do with a restricted subset of language or framework features, nor will you need to call Cloud Foundry specific APIs. You just develop your application as you do without Cloud Foundry, then you deploy it.“
So, why should you think about using another PaaS solution instead of Cloud Foundry? Cloud Foundry applications are traditional Java web applications which are using Spring and being deployed to a Tomcat web container. You do not have many limitations (remember the Java classes white list of GAE) or database restrictions (remember the BigTable concepts of GAE). Be aware that due to this advantage, you have to use the services offered by Cloud Foundry! At the moment, you can use MySQL, Redis, Mongo DB and RabbitMQ. No other databases or messaging solutions can be used. If the offered services meet your demands, everything is fine.

Almost all Cloud Foundry Commands are available in the Roo Shell

Usually, you develop a Cloud Foundry application in an IDE such as Eclipse. Besides, you use the VMware CLI (which is a command line tool) to login to Cloud Foundry, create and bind services, deploy, start and stop your application, and so on.
Spring Roo offers more than 30 unique Cloud Foundry commands. With Roo’s Cloud Foundry integration, you can now manage the entire life cycle of your application from the Roo shell. That is great! Of course, VMware wants to push both, Cloud Foundry and Spring Roo, so the connection between both products is really good. But …

There is no Reason to use Spring Roo for Cloud Foundry Development

Spring Roo’s goal is to help the developer to realize applications easier and faster. It is awesome for creating prototypes or CRUD web applications. Nevertheless, it does not help to create Cloud Foundry applications. Sure, you can use all VMC commands directly within the Roo shell, but that’s it. I wonder if this is an advantage? I found it annoying to always type „cloud foundry“ in the Roo shell before entering the real command which I wanted to use. Thus, I switched back to the VMC command line tool quickly. The SpringSource Tool Suite also offers a Cloud Foundry plugin to bind services and deploy applications via „drag and drop“. Very nice!
In my opinion, there is no benefit to use Spring Roo for developing Cloud Foundry applications. There is one exception, of course: If you develop a Spring Roo application (let’s say a CRUD app), then you can do everything within the same shell, that is cool.
By the way: Though I do think that the combination with Spring Roo brings no benefits, I really like Cloud Foundry. It is one of the first PaaS solutions (besides Amazon Elastic Beanstalk) which offers relational database support. Besides, it is possible to deploy to public AND private clouds. It is open source, thus much more support and services will be available in the future. But be aware: Contrary to GAE, Cloud Foundry is still BETA at the moment.
The current conclusion of this article series is that Spring Roo does not really help to develop applications for the cloud. Nevertheless, I like Spring Roo and I like PaaS solutions such as GAE and Cloud Foundry – but not combined. I will write further articles if this situation changes or if further PaaS products are supported by Spring Roo.

Reference: Rapid Cloud Development with Spring Roo – Part 2: VMware Cloud Foundry from our JCG partner Kai Wahner at the Blog about Java EE / SOA / Cloud Computing blog.

Related Whitepaper:

Functional Programming in Java: Harnessing the Power of Java 8 Lambda Expressions

Get ready to program in a whole new way!

Functional Programming in Java will help you quickly get on top of the new, essential Java 8 language features and the functional style that will change and improve your code. This short, targeted book will help you make the paradigm shift from the old imperative way to a less error-prone, more elegant, and concise coding style that’s also a breeze to parallelize. You’ll explore the syntax and semantics of lambda expressions, method and constructor references, and functional interfaces. You’ll design and write applications better using the new standards in Java 8 and the JDK.

Get it Now!  

Leave a Reply

one + 1 =

Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books