It’s very easy to get Neo4j running on RedHat’s OpenShift Cloud Platform. Note that at the time of writing this, there is no Neo4j cartridge available at OpenShift.

If you are familiar with Heroku, think that a cartridge is like a Heroku Add-on. It plugs functionality into the PaaS environment.

So, how we can use Neo4j at OpenShift? First, remember to always read a README file, if there’s one.

When you create a project at OpenShift, a README file can be located at the root directory of your app. Among other things, we have this line:

../data - For persistent data (also in env var OPENSHIFT_DATA_DIR)

Hmmm that’s interesting! Heroku doesn’t have a place for persistent data across Heroku’s dynos. They are ephemeral, as said by James Ward, here.

From now on, you can guess what to do, right?

The answer is inside of Spring applicationContext.xml file:

<neo4j:config storeDirectory="${OPENSHIFT_DATA_DIR}/graph.db"/> 

To let things more easy, I built a OpenShift skeleton app so I don’t have to do it again and again..

You can view and fork it here:

Oh! Almost forgot! You can read all the 10 steps of this post title, in the project file!


Join the conversation! 8 Comments

  1. Nicely done on your post. When I try to get neo4j spatial running I will reference you guys for the getting started.

  2. […] 10 Steps to run Spring Data Neo4j at OpenShift. […]

  3. When I deploy my project (CDI, JSF, Spring, Neo4j) to openshift, the server alway throw th waning log as:

    WARN [org.jboss.modules] (MSC service thread 1-3) Failed to define class org.neo4j.kernel.impl.osgi.OSGiActivator in Module “deployment.ROOT.war:main” from Service Module Loader: java.lang.LinkageError: Failed to link org/neo4j/kernel/impl/osgi/OSGiActivator (Module “deployment.ROOT.war:main” from Service Module Loader)
    … …
    Caused by: java.lang.NoClassDefFoundError: org/osgi/framework/BundleActivator
    at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_22]

    Please give me any suggestion in this situation
    Thanks Steven.

  4. Hi, i’ve created a cartridge for neo4j for openshift.
    You can check it at

  5. Hey Daniel!

    I added the cartridge in my openshift application. But i dont get how to start the Neo4J server?
    I have fer queries :
    1. Does the cartridge give a standalone instance or it is for the embeded?
    2. If it is a standalone then how to start the server?
    3. How to see the admin panel or the browser?

    Please reply

Send your thoughts

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


jboss, neo4j, openshift, spring-data, springframework


, , , ,