Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

63 lines (31 sloc) 1.059 kb

MongoDB-backed Session State Sample

Run Locally

Build the project with Maven:

mvn package

Configure the MONGOHQ_URL environment variable to point to a local MongoDB instance:

  • Linux/Mac

    export MONGOHQ_URL=mongodb://
  • Windows

    set MONGOHQ_URL=mongodb://


Now you can run your webapp with:

  • Linux/Mac

    $ sh target/bin/webapp
  • Windows

    $ target\bin\webapp.bat

Try the application in your browser by navigating to:


Run on Heroku

Install the Heroku Toolbelt

Login to Heroku from the command line

heroku login

In the root directory of this project do the following:

Create the app on Heroku with the "cedar" stack and the free MongoHQ add-on

heroku create --stack cedar --addons mongohq:free

Deploy to Heroku

git push heroku master

Open the application in your browser

heroku open
Jump to Line
Something went wrong with that request. Please try again.