12.2. GWT OpenShift Project
Project fins developed so far is configured for App Engine and there are two options to deploy its code on OpenShift.
create a new project and import the code.
modify the existing project.
As we are exploring the functionalities of OpenShift with a demo application, we suggest you to go with a new project. For a live project, we suggest the second one.
Create a new project
In this method, we create a new project and import the fins.
Use New Web Application wizard to create new project. Choose GDT Pulldown → New Web Application Project … or File → New → Web Application Project and fill details
Project Name -
project name may be anything
Use Google Web Toolkit -
Use Google App Engine -
Google App Marketplace -
Generate Sample Code -
Project name may be anything but package name should be in.fins.
Next import full-code or sec-backends from part-3.zip as explained in Import Code in Chapter 5 - Model.
gwt-visualization-1.1.2.jar from Project fins -
to new project
war/WEB-INF/lib directory and add the jar to project
In case you are using IvyDE, add ivy.xml as Ivy library
In case your are not using IvyDE, copy jars from Project fins -
war/WEB-INF/lib to new project
war/WEB-INF/lib directory and add the
jars to project build path. To connect to MySQL fins need MySQL
connector so add
mysql-connector-java-5.1.25.jar to project lib
directory and build path.
Modify the existing project
Another method is to modify the existing fins project and remove/modify App Engine specific items. Steps to do so are
go to the project context menu and choose Build Path → Configure Build Path and in Java Build Path dialog select Libraries tab and remove App Engine SDK entry.
next in project’s context menu, choose Google → App Engine Settings … and in App Engine dialog, deselect Use Google App Engine checkbox.
remove all App Engine related jars from
war/WEB-INF/lib, which were added by GPE when App Engine support was enabled.
add DataNucleus, Hibernate and MyBatis related jars as explained in Persist
remove SystemServiceServlet entry and hash out GaePersistTask entry from
src/META-INF/jdoconfig.xmland change datastore config to a RDBMS like HSQLDB. Modify
src/in/fins/shared/package.jdoand set value-strategy attribute of Data and DataGroup to uuid-string. Make sure that DataNucleus support is enabled for the project and classes are enhanced.
Remember to remove DataNucleus support when reverting back to App Engine as App Engine enhances class automatically on each build.
if app uses Hibernate as ORM, then modify
src/META-INF/fins.propertiesand set ORM to Hibernate. It also requires an additional validator library hibernate-validator ( same major version as hibernate-core) and also slf4j-api and slf4j-log4j . It’s important to note that while moving back to App Engine you have to remove hibernate-validator and slf4j libraries else GAE raises some weird exception. (this applies only when you use Hibernate as ORM. For OpenShift, we are going with JDO with MySQL as RDBMS)
To connect to MySQL, fins need MySQL connector, so add
war/WEB-INF/liband add the jar to build path.
As App Engine related libraries are removed from lib you will have error
in.fins.server.task.GaePersistTask classes, but these error will not
stop the app from running on an App Server.
Back to GAE
Anytime you want to revert the project back to Google App Engine, reverse the above mentioned steps.
In the next section, we explain the configuration changes required in the project (either the new one or the existing project) to run it on OpenShift.