You can add many different types of artifacts to business-level
applications. For example, you can add applications or modules, Java archives (JAR files), data in compressed
files, and other business-level applications. This example describes
how to create an empty business-level application and then add a Service
Component Architecture (SCA) JAR file to the application using scripting.
Before you begin
Install the Feature Pack for SCA. Installing the feature
pack adds SCA sample files to the app_server_root/installableApps directory.
If you selected to install Samples during creation of a profile enabled
by the feature pack, the product also adds several SCA sample files
to the app_server_root/samples/SCA directory.
Also,
verify that the target server is configured. As part of configuring
the server, determine whether your application files can run on your
deployment target. You must deploy SCA composite assets of a business-level
application to a Version 7.0 server or cluster that is enabled for
the Feature Pack for SCA.
About this task
For this example, use wsadmin scripts in the Jython or
Jacl language to create a business-level application named HelloWorldAsync
that has an SCA JAR file, helloworld-ws-asynch.jar,
as an asset. The JAR file is available in app_server_root/installableApps.
Procedure
- Start the wsadmin scripting tool.
- Create an empty business-level application named HelloWorldAsync.
Use the createEmptyBLA command to create the business-level
application.
Using Jython:
AdminTask.createEmptyBLA('-name HelloWorldAsync')
Using
Jacl:
$AdminTask createEmptyBLA {-name HelloWorldAsync}
After
the command runs, the blaID output displays in the command window:
WebSphere:blaname=HelloWorldAsync
You
can run the listBLAs command to view a list of all business-level
applications in the cell and to confirm that the HelloWorldAsync business-level
application exists.
Using Jython:
AdminTask.listBLAs()
To view a more readable
list of business-level applications, try
print before
the command:
print AdminTask.listBLAs()
Using
Jacl:
$AdminTask listBLAs
- Import the SCA JAR asset.
Use the importAsset
command to import the JAR file to the product configuration repository.
Using
Jython:
AdminTask.importAsset('-source app_server_root/installableApps/helloworld-ws-asynch.jar')
Using
Jacl:
$AdminTask importAsset {-source app_server_root/installableApps/helloworld-ws-asynch.jar}
After
the command runs, the assetID output displays in the command window:
WebSphere:assetname=helloworld-ws-asynch.jar
You
can run the listAssets command to view a list of all assets in the
cell and to confirm that the helloworld-ws-asynch.jar asset exists:
Using
Jython:
AdminTask.listAssets()
To
view a more readable list of assets, try
print before
the listAssets command:
print AdminTask.listAssets()
Using
Jacl:
$AdminTask listAssets
- Add the SCA JAR asset as a composition unit of the business-level
application.
Use the addCompUnit command to add the
asset to the business-level application.
Using Jython:
AdminTask.addCompUnit('[-blaID HelloWorldAsync -cuSourceID helloworld-ws-asynch.jar -MapTargets [[ .* SCA_server_name ]] ]')
Using
Jacl:
$AdminTask addCompUnit {-blaID HelloWorldAsync -cuSourceID helloworld-ws-asynch.jar -MapTargets {{ .* SCA_server_name }} }
SCA_server_name is
the name of the target server or cluster; for example, server1.
The target must be enabled for the Feature Pack for SCA. You must
specify only a single server or cluster as the target, and not map
an SCA composition unit to multiple servers or clusters.
After
the command runs, the composition unit ID output displays in the command
window:
WebSphere:cuname=helloworldws
During
deployment of the composition unit, you can view the Uniform Resource
Identifier (URI) for composite level service of some bindings, along
with the service name and binding type. Only the URI is editable.
The product does not validate the URI.
You can run the listCompUnits
command to view a list of all composition units in a specified business-level
application and to confirm that the helloworldws composition unit
exists in HelloWorldAsync.
Using Jython:
AdminTask.listCompUnits('-blaID HelloWorldAsync')
Using
Jacl:
$AdminTask listCompUnits {-blaID HelloWorldAsync}
- Save the configuration changes.
Using Jython:
AdminConfig.save()
Using
Jacl:
$AdminConfig save
- Start the HelloWorldAsync business-level application.
Use the startBLA command to start the application.
Using
Jython:
AdminTask.startBLA('-blaID HelloWorldAsync')
Using
Jacl:
$AdminTask startBLA {-blaID HelloWorldAsync}
Verify
that you see the following message indicating that the application
started successfully:
CWWMH0196I: BLA "WebSphere:blaname=HelloWorldAsync" was started successfully.
Optionally,
query the status to see whether the application is running with the
getBLAStatus command.
Using Jython:
AdminTask.getBLAStatus('-blaID HelloWorldAsync')
Using
Jacl:
$AdminTask getBLAStatus {-blaID HelloWorldAsync}
The
following message indicates that the application is started:
BLA: WebSphere:blaname=HelloWorldAsync State of BLA WebSphere:blaname=HelloWorldAsync is Started.
- Exit the wsadmin command shell.
exit
What to do next
Optionally examine, and possibly use in applications,
other SCA sample files in app_server_root/installableApps or app_server_root/samples/SCA.
If
the business-level application does not start, ensure that the deployment
target to which the application maps is running and try starting the
application again. If SCA composite assets do not start, ensure that
each asset is mapped to a deployment target that is enabled for the
Feature Pack for SCA.
If an asset composition unit uses an Enterprise
JavaBean (EJB) binding and does not start because it has a non-WebSphere
target of "null", delete the asset composition unit and add
it again to the business-level application. Specify a target enabled
for the Feature Pack for SCA when you add the asset to the business-level
application. You cannot change the target after deployment.
If
the SCA application uses security, the target server or cluster must
be in the global security domain.
In multiple-node environments,
synchronize the nodes after you save changes to the target before
starting the business-level application.