Instructions to build, deploy and run JEST demo
- Step 1: Download OpenJPA binary
- OpenJPA binaries are available from OpenJPA
The nightly snapshots of version 2.2.0 that includes JEST are ready for
download at lower half of the page.
- Step 2: Get the JEST demo application
- A simple servlet based application is used to demonstrate JEST usage. This simple
application merely defines a persistent unit with two persistent classes: Actor
and Movie. The source code, persistence unit descriptor
META-INF/persistence.xml, deployment descriptor WEB-INF/web.xml
and Ant-based build script are available from OpenJPA svn repository.
Checkout these source files from the repository to a local directory.
The following command:
$ svn co https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-examples/jest .
will bring the code to the current directory, for example.
- Step 3: Configure for your environment
The persistence unit descriptor META-INF/persistence.xml for the example application
needs to be configured with database details. By default, it is configured for a MySQL database.
The build script requires the location of openjpa library and servlet API library jar.
Edit build.properties file to set the variables to locations appropriate for
- Step 4: Build the application
Just run good old Ant.
The build script buid.xml will compile few Java classes of the application, enhance
the persistent classes and package them into a web archive demo.war for deployment.
The deployment descriptor WEB-INF/web.xml for this web archive specifies two servlets:
one for this simple application and the other is JEST servlet. It may be instructive to take a
look at the WEB-INF/web.xml to see how JEST is deployed.
The web archive packages the openjpa library as well in WEB-INF/lib. You may prefer
other deployment options such as placing openjpa library in a shared library of your favorite
application server or servlet container. You do need to modify the build script in that case.
- Step 5: Deploy the web archive
Once the web archive is ready, deploy it in an application server or servlet container by
following standard practice. Needless to say, the database driver specified in
META-INF/persistence.xml should also be available in the deployment environment.
- Step 6: Browse with JEST
Once the web archive has been deployed, you can verify by visiting the home page (and the only page)
of the sample application in your browser
The context path of the deployed servlet is demo as you may have noticed in WEB-INF/web.xml.
The JEST servlet is just next door at
notice the trailing forward slash in the URL above
Now you should see JEST home page with colorful icons. Enjoy browsing!