Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop OSGi applications > Develop and deploying an OSGi application


Deploy an OSGi application as a business-level application

Import an OSGi application as an enterprise bundle archive (EBA) asset, then add the asset to a business-level application by creating a composition unit. Optionally, add a composite bundle extension to the composition unit.


Before you begin

This topic assumes that we have already created an enterprise OSGi application packaged as an EBA file, for example as described in Create an OSGi application. You might also have developed a composite bundle extension, as described in Extend a deployed OSGi application.

As well as specifying the configuration information for the EBA asset through the following procedure, you can also change it later as described in Modify the configuration of an OSGi composition unit. For example, if you update a bundle in an EBA asset, or replace a composite bundle extension, you might introduce a resource that requires additional configuration, such as a new or changed Blueprint resource reference, or security role mapping.


About this task

To deploy an OSGi application in WAS, you import your OSGi application (EBA file) as an asset and create an empty business-level application. You then add a composition unit to the business-level application. This composition unit consists of the new EBA asset plus configuration information for the context roots, virtual hosts, security role mappings, and web application or Blueprint resource bindings for your OSGi application. The composition unit can also include composite bundle extensions.

A business-level application is scoped to cell scope, therefore only one instance of a given OSGi application can be deployed in a cell.

This topic describes the specific task of deploying an OSGi application and any composite bundle extensions as a business-level application. The more generalized task of creating any business-level application is described in Create business-level applications.

Each step can be completed using either the administrative console or wsadmin commands. We can also create an empty business-level application or add a composition unit using programming.

Demonstration of this task (4 min)

nov2011


Procedure

  1. Import the EBA file as an asset.

    We can import the asset before or after you create the empty business-level application. An EBA file can be imported into only one asset.

    To import the EBA file , navigate to Applications > New Application > New Asset. See Import assets.

    To import the EBA file using the importAsset command, enter (for example) the following command:

    AdminTask.importAsset(["-storageType", "FULL",
                           "-source", com.ibm.ws.eba.helloWorldService.eba])
    
    See the step "Import assets to the configuration" in topic Set up business-level applications using wsadmin.sh.

    Notes:

    • When you import the EBA file as an asset, it is checked for any bundle dependencies. If the OSGi application has dependencies on bundles that are not included in the EBA file, the dependencies are resolved against any configured bundle repositories. Asset registration cannot complete unless all missing dependencies are available from configured bundle repositories.

    • When asset registration completes, if the asset requires bundles to be downloaded from bundle repositories, a warning message is displayed telling you to save changes to the master configuration after completing the asset import. When you save changes, the missing dependencies are downloaded from the configured bundle repositories.

    • If the asset uses Java 2 security, the security permissions are displayed. This information comes from the META-INF/permissions.perm file for the application. See Java 2 security and OSGi Applications.
    • Do not add the asset to a business-level application until the bundle download has completed. We can view the download status of the bundles from the administrative console, or by calling the areAllDownloadsComplete () method of the BundleCacheManager MBean. See Interacting with the OSGi bundle cache.

  2. Create an empty business-level application.

    To create an empty business-level application using the administrative console, navigate to Applications > New Application > New Business Level Application. See the step "Create an empty business-level application" in topic Create business-level applications with the console.

    To create an empty business-level application using the createEmptyBLA command, enter (for example) the following command:

    AdminTask.createEmptyBLA('[-name "helloWorld"
                               -description "helloWorld OSGi sample"]')
    
    See the step "Create an empty business-level application" in topic Set up business-level applications using wsadmin.sh.

    To create an empty business-level application using programming, see Create an empty business-level application using programming.

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

    An EBA asset can be added to only one business-level application. An OSGi composition unit consists of an EBA asset, (optionally) one or more composite bundle extensions, and some or all of the following configuration information:

    • Maps from the composition unit to a target application server, web server or cluster.
    • Configuration of the application's session manager, context roots or virtual hosts.
    • Bindings to any associated web applications or blueprint resource references.
    • Maps from security roles to particular users or groups.

    To add the asset to the business-level application as a composition unit, use one of the following methods:

  4. Optional: Add a composite bundle as an extension to the composition unit.

    After you import the enterprise bundle archive (EBA) file for your OSGi application as an asset, you can update versions of existing bundles but you cannot add extra bundles to the asset. However, after we have added the asset as a composition unit to a business-level application, you can extend the business-level application by adding one or more composite bundles to the composition unit.

  5. Save your changes to the master configuration.

    If you are using wsadmin, run:

    AdminConfig.save()
    


What to do next

You are now ready to start your business-level application..


Subtopics

Parent topic: Develop and deploying an OSGi application

Related concepts:

About OSGi Applications
Assets
Business-level applications
Composition units
Enterprise bundle archive installation
Conversion of an enterprise application to an OSGi application
Enterprise bundle archives
Provisioning for OSGi applications
Java 2 security and OSGi Applications

Related tasks:

Create a service bundle
Create a client bundle
Create an OSGi application
Debug bundles at run time using the command-line console
Secure OSGi Applications
Develop a composite bundle
Create an empty business-level application using programming
Add a composition unit using programming
Convert an enterprise application to an OSGi application
Deploy OSGi applications that use SCA
Interacting with the OSGi bundle cache

Related reference:

OSGi Applications: Troubleshooting tips
Task topic Feedback
Copyright IBM Corporation 2009, 2011. All Rights Reserved.
This information center is powered by Eclipse technology.

+

Search Tips   |   Advanced Search