Deploying Formspider Middle Tier to OC4J

It is possible to deploy Formspider middle tier to any JEE compliant container. This tutorial explains deploying Formspider to an OC4J standalone instance. Please contact us at contact (at) theformspider dot com to be able to download the Formspider WAR File for the OC4J deployment.

Deploying the Formspider WAR File

Open OC4J console from the browser (It should have a URL address similar to the following: http://localhost:8888/em/). Navigate to the Applications menu and click the Deploy button. The Select Archive screen shows up.

Deploying a new application


Proceed with the “Archive is present on local host…” option which is selected by default. Press the “Browse” button to select the Formspider middle tier war file from your local drive. Press the “Next” button.

Select archive


Application Attributes screen shows up. Enter the value “formspider” for both “Application Name” and “Context Root” fields. Click “Next” to continue.

Application attributes


The Deployment Settings screen shows up. Press the “Deploy” button.

Configuring the Database Connection

After the deployment is completed, its time to configure the database connection. There are two ways to define database connection parameters. You can either use “JDBC Resouces” or application web.xml parameters.

Connecting with JDBC Resources

This way gives the opportunity to tune the pooling parameters and it is generally the preferred method in a production environment. Navigate to Administration menu and go to task “JDBC Resources”.

Administration menu


There are two resource type in the “JDBC Resources” screen. “Data Sources” and “Connection Pools”. Click the “Create” button under the “Connection Pools” header.

JDBC Resources


“Create Connection Pool – Application” screen shows up. Proceed with the default values and click “Continue”.

Create Connection Pool - Application


“Create Connection Pool ” screen shows up. Enter the value “Formspider Pool” for the “Name” field. Set “JDBC URL”, “Username” and “Password” of the Formspider schema. Click “Finish” to continue.

Create Connection Pool


“JDBC Resources” screen shows up again. Click “Create” in the the “Data Sources” section. “Create Data Source – Application & Type” screen shows up. Press “Continue” to proceed with the default values.

Create Data Source - Application & Type


“Create Data Source – Managed Data Source” screen shows up. Enter the values “Formspider Data Source” and “jdbc/formspider” for the fields “Name” and “JNDI Location” respectively. Select “Formspider Pool” (which is already defined) for the field “Connection Pool”. Click “Finish” to complete.

Create Data Source


JDBC Resources are created. To enable Formspider deployment to use these resources, navigate to the OC4J main directory. This is where OC4J is installed. Find the Web.xml file of the newly deployed application. The Web.xml file path may differ depending on the OC4J application name and the Formspider WAR file name. It should look something similar to this:

C:\[OC4J Installation Path]\j2ee\home\applications\formspider\fs-1.0\WEB-INF\

In the web.xml file, set “engineJdbcName” parameter to the value “jdbc/formspider” which is defined in the “JNDI Location” field in the “Create Data Source” screen.

<context-param>
  <param-name>engineJdbcName</param-name>
  <param-value>jdbc/formspider</param-value>
</context-param>

Defining "engineJdbcName" parameter in web.xml file


Save the file and restart the OC4J.

Connecting with Web.xml File Parameters

It is also possible to define the database connection parameters in the web.xml file without creating any resources in the OC4J. This way is generally preferred in s development environment. Open web.xml file (how to find the web.xml file is described above) and edit the parameters, “engineSchemaURL”, “engineUsername”, “enginePassword” as the following:

  • set “engineSchemaURL” to JDBC URL of Formspider schema
  • set “engineUsername” to Formspider schema name
  • set “enginePassword” to Formspider schema password

<context-param>
  <param-name>engineSchemaURL</param-name>
  <param-value>jdbc:oracle:thin:@192.168.1.122:1521:ORA10G</param-value>
</context-param>
<context-param>
  <param-name>engineUsername</param-name>
  <param-value>FORMSPIDER</param-value>
</context-param>
<context-param>
  <param-name>enginePassword</param-name>
  <param-value>FORMSPIDER</param-value>
</context-param>

Connection parameters in web.xml file


Save the file and restart the OC4J.