Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop SCA composites > Use OSGi applications as SCA component implementations


Deploy OSGi applications that use SCA

We can deploy OSGi and Service Component Architecture (SCA) applications to servers or clusters as assets, which you add to a business-level application by creating composition units.

This topic assumes that we have already created an OSGi application packaged as an enterprise bundle archive (EBA) file and an SCA composite definition packaged as a JAR file.

An SCA composite packaged with a Web archive (WAR) file cannot use the implementation.osgiapp component.

To deploy an OSGi application that uses SCA, create a business-level application that includes the EBA and SCA assets. You can use the admin console or wsadmin commands to create the business-level application, import the EBA file and SCA composite as assets, and then add the EBA and SCA assets as composition units to the business-level application.

An EBA composition unit consists of the imported asset (the EBA file), plus any configuration information for the OSGi application context roots, virtual hosts, and resource bindings. If a deployed OSGi application is to be extended using composite bundles extensions, apply all extensions to the EBA composition unit (cu) and update the OSGi application to the latest deployment version. We must install all service import and exports that are provided by composite bundle extensions before you can add the SCA asset as a composition unit to a business-level application. For information on using and deploying OSGi composite bundle extensions, see the topic on extending a deployed OSGi application.

For implementation.osgiapp, the component implementation value for the composition unit is the application symbolic name and version.

The following deployment restrictions apply to EBA files:

For information about these and other restrictions, see the topic on multiple SCA implementation packaging considerations.


Procedure

  1. Create a business-level application.

    Ways to create SCA business-level applications. We can create a business-level application that has OSGi and SCA assets using the admin console or wsadmin scripts.

    Option Method
    Administrative console business-level application creation wizard Click Applications > New Application > New Business Level Application and follow instructions in the wizard.

    For example use of the console to create a business-level application that has an SCA asset, see Example: Creating an SCA business-level application with the console.

    wsadmin scripts Use the createEmptyBLA, importAsset, and addCompUnit commands to create the business-level application.

    For example use of scripting to create a business-level application that has an SCA asset, see Example: Creating an SCA business-level application with scripting.

  2. Import OSGi, SCA, or other assets needed by your business-level application.

  3. Add the EBA asset as a composition unit to the business-level application.

    We must add the EBA asset before the SCA asset that references it.

  4. Add the SCA asset as a composition unit to the business-level application.

    By default, the product assigns the SCA composition unit a higher starting weight value than the value for the OSGi composition unit. When using implementation.osgiapp, the SCA composition unit must start after the referenced OSGi composition unit starts. Thus, the SCA composition unit must have a higher starting weight value than the OSGi composition unit. If you override the default values and set a higher starting weight value for the OSGi composition unit than for the SCA composition unit, the business-level application does not start.

    In a Network Deployment environment, target the OSGi composition unit to the same server as the SCA composition unit. If a validation error occurs when adding the SCA asset, saying that a service is not found, ensure that the following conditions exist:

    • The service name matches the name of a blueprint service
    • The Blueprint service uses the services.exported.interfaces property to export its interface
    • The interface is included in the Application-ExportService header of the application manifest

    The absence of these conditions can cause the validation error. The error resembles the following:

    com.ibm.wsspi.management.bla.op.OpExecutionException: CWSAM0105E:
    The following Service Component Architecture (SCA) Validation errors caused the CreateScaCodeGen step to fail:
      Service not found for component service:
       Component = HelloWorldComponent Service = helloWorld
    


Results

The business-level application has OSGi and SCA composition units. We can now start the business-level application.

If the ServiceRuntimeException Unable to access OSGi application framework occurs when starting the business-level application, ensure that the SCA composition unit has a higher starting weight than the EBA composition unit.

If the ServiceRuntimeException Unable to obtain service service from application occurs, check SystemOut.log and SystemErr.log files for messages from the Blueprint container indicating that the run time cannot start the Blueprint service.

If the java.lang.TypeNotPresentException occurs when starting the business-level application, a bundle that uses one of the supported SCA annotations is not importing the org.osoa.sca.annotations package. Update the bundle manifest to import this package.

New feature: Beginning in WAS v8.0 you can configure the server to use the HPEL log and trace infrastructure instead of using SystemOut.log , SystemErr.log, trace.log, and activity.log files or native z/OS logging facilities. If you are using HPEL, you can access all of your log and trace information using the LogViewer command-line tool from your server profile bin directory. See the information about using HPEL to troubleshoot applications for more information on using HPEL.New feature:


What to do next

If delete a composition unit from the business-level application, delete the SCA composition unit before attempting to delete the EBA composition unit, otherwise the product returns an error. An EBA composition unit that provides the implementation cannot be deleted until the SCA composition unit that uses the implementation.osgiapp is deleted.


Related


Multiple SCA implementation packaging considerations
Specify bindings in an SCA environment
Deploy an OSGi application as a business-level application
Extend a deployed OSGi application
Example: Creating an SCA business-level application with the console
Example: Create an SCA business-level application with scripting
Use HPEL to troubleshoot applications

+

Search Tips   |   Advanced Search