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.

This entry was posted in Heroku, Java. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • Pingback: Tutorial & Screencast: Java on Heroku with Eclipse

  • http://twitter.com/stevenelliottjr Steven Elliott

    This is excellent! Also, on an entirely non-programming issue I’d like to say that it’s nice to see a Java screencast that is not made using a Mac! There are more Windows and Linux Java programmers than Mac users I would think. Other than the platform flame bait I have to say that I am excited about the Play! Framework project template. I am getting going on a new startup project and we will be using Heroku for sure! Awesome! 

  • Sinha Pratyush

    This is a great article. Helped me get started with java on heroku. I could change first name, last name and push changes to Heroku too. Now I wanted to do something with facebook graphs using restfb. But I am struggling with this and not able to find answer on net. My project builds in Eclipse, I  have added a new dependency to POM, I can also see this dependency at .m2repositorycomrestfbrestfb1.6.9.  My POM.xml has  dependency clause:
      com.restfb  restfb  1.6.9 

    I get this error – remote rejected – pre-receive hook declined

    [ERROR]/tmp/build_f2rlcvx4fmve/src/main/java/com/example/model/FacebookFirst.java:[5,17]package com.restfb does not exist       [ERROR]

    This may just be a Maven problem but will appreciate your help.

    • http://www.jamesward.com James Ward

      Hi Sinha.  Thanks!  Glad this was helpful.

      That looks correct.  Perhaps you didn’t commit your changes to the pom.xml file to the git repo?

      • Sinha Pratyush

        Thanks James! I first committed pom.xml and then pushed my project and it worked like a charm. Thanks for replying!

  • Dalibor Ninković

    Hi James, great tutorial, I done easily everything from tutorial, but where I got a lot of problems is integration between maven project from eclipse and a local server. I used “m2eclipse-wtp” and now I have 404 on /people/ url, without any errors in logs!? 
    What is the best way to edit now this maven project and work on them locally? 

    • http://www.jamesward.com James Ward

      I haven’t used m2eclipse-wtp so I’m not sure what the problem is.  However you shouldn’t need to deploy to a local server because these templates have their own containers.  Perhaps that confuses m2eclipse-wtp.

      • Dalibor Ninković

        OK, thanks ;) but how do you then edit project and test it locally? I can’t deploy to heroku all the time to see smaller changes, if you have any link for that process that would be very useful. 

        • http://www.jamesward.com James Ward

          Are you using a template with webapp-runner?  If so, then follow the instructions here: https://github.com/jsimone/webapp-runner  (in the Eclipse section)

          Let me know if that works.

          • Dalibor Ninković

            Hallelujah brother, it works ;))) thanks. First time that I use Java web app with webapp-runner, I didn’t know for this before  

          • http://www.jamesward.com James Ward

            Cool!  That is great!

  • Foo

    Hi, Thanks for this awesome tutorial. I have a problem, I’m trying to run this project locally and I get some spring exceptions. Is there any specific config that I’d have to add to my local tomcat in order to fix these? I tried to look at on the web it seems to be linked to the spring version / definition. None of the suggested solutions worked.

    org.springframework.beans.factory.BeanDefinitionStoreException: Line 37 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element ‘beans’. One of ‘{“http://www.springframework.org/schema/beans”:import, “http://www.springframework.org/schema/beans”:alias, “http://www.springframework.org/schema/beans”:bean, WC[##other:"http://www.springframework.org/schema/beans"]}’ is expected.
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element ‘beans’. One of ‘{“http://www.springframework.org/schema/beans”:import, “http://www.springframework.org/schema/beans”:alias, “http://www.springframework.org/schema/beans”:bean, WC[##other:"http://www.springframework.org/schema/beans"]}’ is expected.

    • http://www.jamesward.com James Ward

      That is odd. How are you running the app? Did you use the webapp-runner application?

  • Varundroid

    This tutorial not working any more. I followed this tutorial when i created my first Spring Heroku app and it was working flawlessly but now i updated my eclipse to juno and i am completely unable to copy the project from git. Whenever i try to copy, it shows me project overlap error and if i try to handle this overlap issue then it shows me directory not exist issue. I am kind of stuck now. Any solutions to my problem?

    • Varundroid

      In short Eclipse introduced more bugs with its newer version.

      • http://www.jamesward.com James Ward

        Hmm… This should work in Juno. Can you paste the error messages here?

  • commandlineisbest

    It would be really nice to get some information on how to use Eclipse to start this locally. Especially with web-runner as in the Spring MVC Tomcat template this does not seem obvious because you wouldn’t be running tomcat. Namely how does “java -jar target/dependency/webapp-runner.jar target/*.war” from command line translate to Eclipse click-through? (command line version is here http://www.jamesward.com/2012/02/15/webapp-runner-apache-tomcat-as-a-dependency) Didn’t find anything googling because it is probably trivial.



  • View James Ward's profile on LinkedIn