Example: Create an SCA business-level application
We can add many different types of artifacts to business-level applications. For example, we 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 .
In a product installation, verify that the target server is configured. As part of configuring the server, determine whether the application files can run on the deployment target. We must deploy SCA composite assets of a business-level application to a Version 8.0 or later server or cluster (target) or to a Version 7.0 target that is enabled for the Feature Pack for SCA.
Download the helloworld-ws-asynch.jar SCA sample file from a product download site:
- Go to the Samples, v8.5 information center.
- On the Downloads tab, click FTP or HTTP in the Service Component Architecture section.
- In the authentication window, click OK.
- In the SCA.zip compressed file, go to the SCA/installableApps directory and download the helloworld-ws-asynch.jar file.
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.
- Start the wsadmin scripting tool.
- Create an empty business-level application named HelloWorldAsync.
Use the createEmptyBLA command to create the business-level application.
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
We 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.
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
We 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:
Jython:
AdminTask.listAssets()
To view a more readable list of assets, try print before the 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.
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; for example, server1. The target must support SCA composites. Specify only a single server or cluster as the target, and not map an SCA composition unit to multiple targets.
After the command runs, the composition unit ID output displays in the command window:
WebSphere:cuname=helloworldws
During deployment of the composition unit, we 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.
We 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.
Jython:
AdminTask.listCompUnits('-blaID HelloWorldAsync')
Using Jacl:
$AdminTask listCompUnits {-blaID HelloWorldAsync}
- Save the configuration changes.
Jython:
AdminConfig.save()
Jacl:
$AdminConfig save
- Start the HelloWorldAsync business-level application.
Use the startBLA command to start the application.
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 wsadmin shell.
exit
What to do next
Optionally examine, and possibly use in applications, other SCA sample files in the SCA/installableApps directory of the downloadable SCA samples.
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 supports SCA composites.
If an asset composition unit uses an 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 hat supports SCA composites when we add the asset to the business-level application. We cannot change the target after deployment.
If the SCA application uses security, the target 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.
Related tasks
Start the wsadmin scripting client Example: Create an SCA business-level application with the console Set up business-level applications
Samples, v8.5 information center