1. Create an OpenShift application using following command
$ rhc app-create xwiki jbosseap –gear large
2. Downloaded the xwiki war file from the official web site.
3. Extracted the war file using $ jar xfv xwiki.war
4. Downloaded three jars — guice-servlet, guice, and h2 from http://mvnrepository.com/ and placed the jars in WEB-INF/lib directory. The application expects these jars but don’t bundle them.
5. Update the hibernate.cfg.xml. Basically, we have commented out hsql and uncommented h2. The NullPointerException that you were seeing was because xwiki does not work with JNDI datasource so you have to bind the url manually. If you want to use postgres or mysql then use proper connection url, username, password etc.
6. Pack the war file again using $jar cfv ROOT.war .
7. Copy the artifact to deployments folder in your app source code. Please delete src/ and pom.xml as you are deploying war file.
8. Git commit and push the war.
9. Check the logs.