+

Search Tips   |   Advanced Search

Deploy OSGi applications that use SCA

We can deploy OSGi and Service Component Architecture (SCA) applications to servers or clusters as assets, which we 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. We can use the administrative 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 provided by composite bundle extensions before we 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.

  1. Create a business-level application.

    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: Create 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: Create an SCA business-level application .

  2. Import OSGi, SCA, or other assets needed by the 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 we 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.

    Avoid trouble: 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
    gotcha


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.

This topic references one or more of the application server log files. As a recommended alternative, we can configure the server to use the High Performance Extensible Logging (HPEL) log and trace infrastructure instead of using SystemOut.log , SystemErr.log, trace.log, and activity.log files on distributed and IBM i systems. We can also use HPEL in conjunction with the native z/OS logging facilities. If we are using HPEL, we can access all of the log and trace information using the LogViewer command-line tool from the server profile bin directory. See the information about using HPEL to troubleshoot applications for more information on using HPEL.


What to do next

If we must 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.


Subtopics


Related tasks

  • Specify bindings in an SCA environment
  • Deploy an OSGi application as a business-level application
  • Extending a deployed OSGi application
  • Example: Create an SCA business-level application with the console
  • Example: Create an SCA business-level application
  • Use High Performance Extensible Logging to troubleshoot applications