Samples Overview

Table of Contents

Overview

Affiliates Icon

This environment provides the ability to build, package, and install SCA sample applications in a single server configuration.

The WAS_HOME/samples/SCA environment relies upon ws_ant.bat|sh to execute ant. Each sample directory provides a build.xml which defines appropiate targets for that sample, to be used together with the specific README instructions for each sample.

Experimentation

These samples are written to be used in conjunction with the specification and other documents. However, the most important function that these samples provide is a place to begin experimenting with the SCA API and programming model. Developers are encouraged to extend and experiment with the current set of samples.

Specifications

SCA specifications are hosted by the Open Service Oriented Architecture collaboration.

Basic Usage

Specific to your environment:

  • WAS_HOME: Location where WebSphere Application Server Version 8 is installed. For example: c:\WebSphere\AppServer
  • PROFILE_HOME: Location of profile. For example: c:\WebSphere\AppServer\profiles\myScaProfile

From any of the sample directories located under the WAS_HOME/samples/SCA:

  • Build sample: PROFILE_HOME\bin\ws_ant.bat|sh
  • Install sample application : PROFILE_HOME\bin\ws_ant.bat|sh install
Note: WebSphere Application Server 8 includes SCA capability. Previous versions require that the SCA Feature Pack be installed and profile SCA enabled.

Ant Tasks

Throughout the samples a variety of custom ANT tasks are used for code generation or application installation. The following section provides a brief overview of these options and usage:

Install BLA

Description: Installs BLA (jar file packaging for service)
Task: createBLA
Arguments:
  • blaName: Name to give installed BLA
  • source: Location of jar file
Example:
<target name="exampleTarget"/>
	<antcall target="createBLA">
		<param name="blaName" value="myBLA"/>
		<param name="source" value="${install.dir}/myBLA.jar"/>
	</antcall>
</target>

Install Ear

Description: Installs Ear
Task: installEAR
Arguments:
  • source: Location of ear file
Example:
<target name="exampleTarget"/>
	<antcall target="installEAR">
		<param name="source" value="${install.dir}/myEar.jar"/>
	</antcall>
</target>

Basic BLA Commands Using wsadmin

SCA services are packaged in jar files and can be installed as BLA jar files. This is typically done using wsadmin. The following is a simple set of example wsdadmin commands that can be used to manage BLA applications. Note three commands are required for the full installation and full deletion of the BLA.

  • $AdminTask createEmptyBLA {-name scabla1}
  • $AdminTask importAsset {-source C:/WebSphere/AppServer02/bin/sca/SCAModuleSample1.jar -storageType FULL}
  • $AdminTask addCompUnit {-blaID scabla1 -cuSourceID SCAModuleSample1.jar}
  • $AdminConfig save
  • $AdminTask listBLAs
  • $AdminTask startBLA {-blaID scabla1}
  • $AdminTask stopBLA {-blaID scabla1}
  • $AdminTask deleteCompUnit {-blaID scabla1 -cuID cuName} *The cuName should match the specified config unit name outputed from addCompUnit command
  • $AdminTask deleteAsset {-assetID SCAModuleSample1.jar}
  • $AdminTask deleteBLA {-blaID scabla1}
  • $AdminConfig save

Troubleshooting

Possible problems and workarounds:

ws_ant.sh fails to launch wsadmin task for WebSphere Application Server for z/OS Version 8

Description: Invoking ws_ant targets which use the wsadmin task fail for the z/OS operating system. These tasks include install, start, stop, and so on.
Symptom:

/ScaSamples/MyBank>/WebSphere/Base/AppServer/profiles/default/bin/ws_ant.sh install
Buildfile: build.xml

install:
  [wsadmin] java.lang.NullPointerException
  [wsadmin]     at java.security.SecureRandom.nextBytes(SecureRandom.java:287)

Solution: This error is corrected in Version 8 Fix Pack 1 of the product.
Workaround(s):
  • Manual instructions as provided with each sample may still be used.
  • Alternatively, provided wsadmin scripts may be used directly. Under each sample there is a scripts directory which contains a wsadmin python script. Ordinarily ws_ant builds a commandline and executes the wsadmin task. Here, we will directly invoke wsadmin.
    1. Open a command window and change to the sample directory, e.g. /ScaSamples/MyBank.
    2. Issue the following command to execute a task for the sample:

      <WAS_HOME>/profiles/<PROFILE_NAME>/bin/wsadmin.sh -f scripts/build.py <task> <sample directory> <variation-number>

      Example command:

      /WebSphere/Base/AppServer/profiles/default/bin/wsadmin.sh -f scripts/build.py install /ScaSamples/MyBank 0