Java

Screencast: Java Template Apps on Heroku

Today Heroku launched a new way to get started deploying Java apps on the cloud. There are four different template apps you can start with including a Spring + Hibernate + Tomcat app, a Containerless Jetty app, a Play! app, and a JAX-RS app. Pick a template and with a few clicks a copy of the template will be deployed on Heroku - just for you! Get started at:

heroku.com/java

Here is a screencast that walks through the steps to deploy a new Java template app on Heroku, then setup SSH authentication (for pulling and pushing code with git), pull the code into Eclipse, make a change, and push the changes back to Heroku. Check it out and let me know what you think.

Java on Heroku Next Week at Cloudstock 2012

Next week in San Francisco at Cloudstock 2012 I will be doing a presentation called “Introduction to Heroku: Building Next Generation Apps”. Here is the session description:

Many emerging technology trends like PaaS, HTML5, mobile apps, API-driven development, and continuous deployment are changing the way we build and deliver software. Heroku is a polyglot cloud application platform at the forefront of these trends. This introductory session will teach you what Heroku is and how you can use it to build next-generation apps that make software delivery more efficient and scalable.

Webapp Runner – Apache Tomcat as a Dependency

John Simone, a fellow co-worker at Heroku, has created webapp-runner which provides an easy way to specify Tomcat as a dependency of your app and launch Tomcat. This is useful for making it simple to test your app locally but it also helps to avoid issues stemming from differences in runtime environments.

Here is how to use it from a Maven pom.xml build:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>hellojavawebapprunner</artifactId>
    <name>hellojavawebapprunner</name>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.github.jsimone</groupId>
            <artifactId>webapp-runner</artifactId>
            <version>7.0.22</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <webappDirectory>${project.build.directory}/${project.artifactId}</webappDirectory>
                    <warName>${project.artifactId}</warName>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals><goal>copy-dependencies</goal></goals>
                        <configuration>
                            <includeArtifactIds>webapp-runner</includeArtifactIds>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Then just run the Maven build:

Video: Spring Roo and Grails Apps on the Cloud

At SpringOne 2GX I did a presentation about running Spring Roo (really Spring anything) and Grails apps on the cloud with Heroku. A video recording of my session has been posted on InfoQ.

If you want to try out Spring Roo or Grails on Heroku then one way is to deploy a copy of one of the demos I showed. I’ve created a little app that makes that easy. Just go to java.herokuapp.com and select a demo then enter your email address (your Heroku username) and click Go! A copy of the demo will be deployed for you on Heroku and then you will see instructions on how to get started with it. Give it a try and let me know what you think.

Deploy Containerless Tapestry Apps on Heroku

Recently I spent some time with Howard Lewis Ship, creator of the Apache Tapestry web framework. Howard is a technical rock star so it was really fun to sit down with him and hack on some code. Our goal was to make it easy for people to run their Tapestry apps on the cloud with Heroku. You can run anything on Heroku so there are a variety of ways to run Tapestry apps on Heroku. We wanted to put together something that helps Tapestry users run their apps in the most optimal way. What we came up with is available in Howard’s tapx-heroku package on GitHub. Lets walk through what it does.

Heroku at Jfokus and Spring I/O 2012

In just a few weeks I’ll be over in Europe presenting about Heroku at two fantastic Java conferences. First up is Jfokus in Stockholm! On February 14 at 20:00 I will be leading a Cloud Conversations BoF. Then on February 15 at 11:10 I will be speaking about how to “git push” Java & Play! Apps to the Cloud. This will be my first time speaking at Jfokus and I’m really excited because I’ve heard such great things.