Building and Running OpenBooksPage edited by Kevin SutterChanges (42)
Full ContentInstructions to download and run OpenBooks DemoOpenBooks comes with
Follow the simple instructions below to build and run OpenBooks: Download InstructionsOpenBooks can be checked out from OpenJPA repository. $ svn co https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-examples/openbooks. will check out the source code and build scripts of OpenBooks in current directory. OpenBooks requires following software environment to run:
Configure build and run environmentOpenBooks builds with Ant. The Ant build script is somewhat involved because OpenBooks can be built and packaged either as a JSE (Swing based) application or a JEE Web Application. By default, OpenBooks is built as a JSE application. 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. Before you run a build, configure the build environment by editing openjpa-examples/openbooks/build.properties. Essentially, you need to
Note: Access to the OpenJPA class libraries is easier if you have a Maven repository (.m2) available on your system. In this case, all that is required is to update the openjpa.version variable to point at the proper OpenJPA SNAPSHOT version.
The next step is to configure runtime configuration descriptors and environment variables.
Both build.properties and run.properties files are commented in-place on what is to be edited. Build OpenBooks from sourceOnce you have configured the environment, simply issue (from the openjpa-examples/openbooks directory): $ ant or $ ant -Dbuild.mode=jee The default target of the ant script will
Deploy OpenBooks in an Application ServerDeployment 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 openbooks.war web archive need to be deployed manually. 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_HOME where WAS_HOME denotes the root directory where WAS V7 with JPA 2.0 feature pack has been installed. Yes, OpenBooks requires the WAS V7 JPA 2.0 feature pack with a profile augmented to run with the feature pack. Further information on this feature pack is available here. 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. Run OpenBooksIf you have built OpenBooks for JSE, then go to the target/openbooks directory. Invoke the Ant script to run OpenBooks If you have build OpenBooks for JEE, a Web Application Archive openbooks.war will be created in 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/ to access OpenBooks as an web application. Populate OpenBooks DatabaseOpenBooks checks for existing data at first connection to the database. If the database is empty, the schema is defined and populated with initial data. However, you can explicitly populate the database in JSE build. Note: By default, the OpenBooks example uses and populates an Embedded Derby instance. So, no further configuration or loading is required for the default configuration. Edit load.properties to specify load parameters such as number of Books etc. OpenBooks uses this data to populate a database with some sample data. This example file has some typical values. If you are satisfied with it, you can leave them as it is. Then invoke the Ant script $ ant -f run.xml load
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] OpenJPA > Building and Running OpenBooks confluence
