Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

OpenBooks can be built in JSE and JEE mode – and to keep things simple the common build steps are available in main build script build.xml while JSE and JEE specific packaging steps are described in separate build.jse.xml and build.jee.xml, respectively. Furthermore, for JEE, the deployment step is further refined for each application server. See build.jee.was.xml for WebSphere installation steps and build.jee.liberty.xml for build and installation steps for WebSphere Application Server and the Liberty Profile for WAS, respectively.

Before you run a build, configure the build environment by editing openjpa-examples/openbooks/build.properties. Essentially, you need to

...

The next step is to configure runtime configuration descriptors and environment variables.

  • For JSE environment, edit
    • Edit persistence.xml located in openjpa-examples/openbooks/src/main/resources/META-INF directory. Modify the javax.persistence.jdbc.driver and javax.persistence.jdbc.url property to suit your local database and its driver.
    In JSE mode, edit
    • Edit openjpa-examples/openbooks/run.properties to specify location of OpenJPA class libraries and JDBC Driver used in runtime classpath. Here again, the use of the openjpa.version variable with a Maven repository makes the library and jdbc driver configuration easy.
  • In JEE environment, you
    • You may already have a JTA data source configured and registered in JNDI. Of course, then the appropriate configuration is to be edited accordingly in the <jta-data-source>
    clause
    • and <non-jta-data-source> clauses. See persistence.jee.was.xml for WebSphere environment, or persistence.jee.liberty.xml for the Liberty Profile.
    In JEE mode,
    • OpenJPA library and JDBC drivers are configured in JEE server and hence variables in this file are irrelevant.
    • More information on the build and installation of the OpenBooks example for application servers can be found in the WebSphere Application Server and Liberty Profile deployment sections.

Both build.properties and run.properties files are commented in-place on what is to be edited.

...

  • generate metamodel classes (required for Criteria API)
  • compile the source code
  • enhance the persistence domain model
  • package the application based on the build.mode as a Swing-based application or a Web Application Archive.
  • copy the deployable artifacts to target and target/openbooks directory directories relative to the current directory.

...

Deployment techniques and configuration vary across JEE compliant application servers. Hence, OpenBooks does not provide an uber-deployment script for all application server. Instead, application server specific steps are encoded in separate build scripts for each application server. Using generic build as described in the previous section, the target/openbooks.war web archive need needs to be deployed manually.

Anchor
websphere
websphere

WebSphere Application Server

For WebSphere Application Server, automated build scripts are available in build.jee.was.xml. WebSphere deployment needs to be triggered by ws_ant utility as follows

$ ws_ant -Dbuild.mode=jee -Dappserver=was -Dwas.home=WAS<WAS_HOMEHOME>

where WAS<WAS_HOMEHOME> denotes the root directory where WAS V7 with JPA 2.0 feature pack has been installed (at a minimum). Yes, OpenBooks requires features defined by the JPA 2.0 specification, thus the use of the WAS V7 JPA 2.0 feature pack with a profile augmented to run with the feature packis a minimum requirement. Further information on this feature pack is available here or WebSphere in general.

The WebSphere specific build will configure appropriate JTA data sources using a python script (found under openbooks/scripts/ directory before deploying OpenBooks as a web application. The script assumes a single server instance. If multiple profiles exist, the script will use the first server profile.

Anchor
liberty
liberty

Liberty Profile in WebSphere Application Server v8.5

For the Liberty Profile in WebSphere Application Server v8.5, automated build scripts are available in build.jee.liberty.xml. Liberty Profile deployment is very easy and needs to be triggered by ant as follows

$ ant -Dbuild.mode=jee -Dappserver=liberty -Dliberty.home=<WAS_HOME>/wlp -Dliberty.server=<server name>

where <WAS_HOME> denotes the root directory where WAS v8.5 has been installed, and <server name> is the name of your Liberty Profile server. Instead of specifying these two variables, liberty.home and liberty.server, you could modify the build variables in the build.jee.liberty.xml file.

By specifying liberty.home and liberty.server, the ant script will attempt to "deploy" the resulting openbooks.war application to the designated Liberty server. Additional configuration of your Liberty server may be required before OpenBooks will work. For example, you will need to specify the jpa-2.0 and jdbc-4.0 features in your server.xml. You will also need to define the JTA datasources used by the OpenBooks application via your server.xml file. Examples of a derby configuration can be found in the openbooks/scripts/liberty directory.

Additional information on the Liberty Profile can be found here. General WebSphere information can be found here.

Run OpenBooks

If you have built OpenBooks for JSE, then go to the openjpa-examples/openbooks/target/openbooks directory.

Invoke the Ant script to run OpenBooks
$ ant -f run.xml

If you have build built OpenBooks for JEE, a Web Application Archive openbooks.war will be created in openjpa-examples/openbooks/target/openbooks directory. You need to deploy openbooks.war to a JEE Application Server. Once deployed, you can point a browser to Application Server URL

http:// < app server host >:<port>/openbooks/

For example,

http://localhost:9080/openbooks/Image Added

to access OpenBooks as an a web application.

Populate OpenBooks Database

...