You can install, run, and monitor an application that mimics
account transaction processing using the Postingv2Sample sample. The
sample is built using the simple Plain Old Java Object (POJO) model and packaged using
the batch packager, WSBatchPackager.
Before you begin
- Augment existing WebSphere® Application
Server profiles to support the feature pack or create profiles that
include support for the feature pack.
- Start the appropriate application servers and any supporting management
processes.
- Configure the location of the job scheduler.
The following steps
assume that you are setting up a stand-alone application server test
environment to explore the capabilities of the feature pack.
If
you are setting up a clustered environment, you must perform additional
steps. You must create a network database to support the job scheduler.
You must configure related job scheduler database connectivity settings.
Read the topic about configuring the job scheduler.
- On the administrative console, click System administration
> Job scheduler.
- Set Scheduler hosted by to the identity of the appropriate
application server.
WebSphere:cell=ndcell,node=node1,server=server1
- Save the changes.
About this task
Use the following general procedure to set up a database
for the Postingv2Sample sample, and install and run the sample. Read
the topics about the job scheduler, the job management console, and
developing applications for detailed information.
Avoid trouble: You
must have a compatible network database such as DB2
® or Oracle. This sample does not work with
Apache Derby because multiple simultaneous connections are created
during a step.
gotcha
Procedure
- Set up the DB2 or
Oracle network database for the Postingv2Sample sample.
The
database is for the sample itself. The job scheduler has its own database.
- Run the java –version command.
By running the command, you can verify that Java Version 1.6 or later is installed and included
in the PATH variable of your operating system.
- Create the database.
Use the appropriate
DDL file that is located in the following directory. Examples of DDL
files are createPostingsV2TableDB2.ddl and CreatePostingsV2TablesOracle.ddl.
<app_server_root>/feature_packs/BATCH/longRunning
<app_server_root>\feature_packs\BATCH\longRunning
For
example, for DB2, create the
ACTDB database, then open the DB2 command
prompt and run db2 -tf <path to the ddl file>.
- Create the Java Database
Connectivity (JDBC) resources.
- On the administrative console, click Resources > JDBC > JDBC
providers.
- Create a JDBC XA provider at the server scope with the following
properties:
- Database type
- DB2.
- Provider type
- DB2 Universal JDBC Driver
Provider.
- Implementation type
- XA data source.
- Name
- DB2 Universal JDBC Driver
Provider (XA).
- Description
- Accept the default value.
- On the administrative console, click Resources > Data Sources
> Default Datasource.
- Create a component-managed authentication alias for user name
and password access to the DB2 database:
In
the Related Items column, click
JAAS - J2C authentication data and
complete the following properties:
- Alias
- Enter a Component-managed authentication alias value.
- Username
- Enter the user name with which to access DB2.
- Password
- Enter the password for the user name.
- Click OK.
- On the administrative console, click Resources > JDBC > Data source.
- Create a data source.
- Data source name
- Enter the following information: Postings data source
(XA).
- Java Naming and Directory
Interface (JNDI) name
- Enter the following information: jdbc/postingsv2.
Click Next.
- JDBC provider
- Select the existing JDBC provider DB2 Universal
JDBC Driver Provider.
Click Next.
- Database name
- Enter ACTDB, which is the name of the DB2 database for this example.
- Server Name
- Enter the IP address of the DB2 instance.
- Port Number
- Enter the port number of the DB2 instance.
Click Next.
- Container-managed authentication alias
- Select the Component-managed authentication alias that you created
in a previous step.
Click Next, then Finish.
- Select the new data source and click Test Connection to
test the connection to the database.
- Install the Postingv2Sample sample.
- In the administrative console, click Applications
> New application > New Enterprise Application.
- Specify the full path of the sample; for example:
<app_server_root>/feature_packs/BATCH/installableApps/Postingv2Sample.ear
<app_server_root>\feature_packs\BATCH\installableApps\Postingv2Sample.ear
- Complete the steps using the wizard.
- Select Detailed - Show all installation options and parameters.
- Expand the list for Choose to generate default bindings and
mappings; Select Generate Default Bindings; click Next.
- In Step 2, select the endpoint server or cluster.
- Accept the defaults for the rest of the values.
- Click Finish.
- If you plan to install additional sample applications,
do so now.
- Restart the application server or start the application.
If this time is the first time that you are installing an
application, restart the server. Otherwise, you can start the application
under the Applications > Application Types > WebSphere enterprise applications panel.
- Run the Postingv2Sample sample.
- Edit the postingsv2samplexJCL.xml xJCL
file.
You use the xJCL file to submit a job to the Postingv2Sample
sample.
The file is located in the following directory:
<app_server_root>/feature_packs/BATCH/longRunning/postingsv2samplexJCL.xml
<app_server_root>\feature_packs\BATCH\longRunning\postingsv2samplexJCL.xml
- Start the job management console.
In a
web browser, type the following web address:
http://<job
scheduler server host>:<port>/jmc
<job
scheduler server host> is the host address and <port> is
the WC_defaulthost port of the application server on which the running
job scheduler is installed.
To view on the administrative console
the port numbers assigned to a given application server, click Servers
> Server Types > WebSphere application servers
> server_name > Communications > Ports.
- Submit the postingsv2samplexJCL.xml xJCL
file.
On the job management console, click Job Management
> Submit a job, and specify the path to the xJCL file.
- Monitor the submitted job.
On the job management
console, click Job Management > View jobs and view jobs based
on characteristics such as the job ID and the job submitter.
You
can determine whether the job completed successfully by going to the
second page of the job viewer and scrolling to the bottom. If the
job did complete successfully, you see a Job completed successfully message.