Network Deployment (Distributed operating systems), v8.0 > Scripting the application serving environment (wsadmin) > Administer applications using wsadmin.sh > Set up business-level applications using wsadmin.sh
Example: Create an SCA business-level application with scripting
We 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.
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 your deployment target. We must deploy SCA composite assets of a business-level application to a v8.0 server or cluster (target) or to a v7.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.0 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.
Procedure
- Start wsadmin.sh.
- Create an empty business-level application named HelloWorldAsync.
Use the createEmptyBLA command to create the business-level application.
### Jython
AdminTask.createEmptyBLA('-name HelloWorldAsync')### Jacl
$AdminTask createEmptyBLA {-name HelloWorldAsync}After the command runs, the blaID output displays in the command window:
WebSphere:blaname=HelloWorldAsyncYou 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()### Jacl
$AdminTask listBLAs
- Import the SCA JAR asset.
Use the importAsset command to import the JAR file to the product configuration repository.
### Jython
AdminTask.importAsset('-source WAS_HOME/installableApps/helloworld-ws-asynch.jar')### Jacl
$AdminTask importAsset {-source WAS_HOME/installableApps/helloworld-ws-asynch.jar}After the command runs, the assetID output displays in the command window:
WebSphere:assetname=helloworld-ws-asynch.jarYou 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()### 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]] ]')
### 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. We must 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=helloworldwsDuring 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.
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')### 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')### 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.
### Jython
AdminTask.getBLAStatus('-blaID HelloWorldAsync')### 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 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 you 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.
Start the wsadmin scripting client using wsadmin.sh
Example: Creating an SCA business-level application with the console
Set up business-level applications using wsadmin.sh
Samples, v8.0 information center