Converting a web application archive file to an OSGi web application bundle

When you convert an enterprise archive (EAR) file to an enterprise bundle archive (EBA) file, you complete manual tasks to convert any web application archive (WAR) files in the EAR file to OSGi web application bundles.

Note: If you do not convert a WAR file manually, it is converted automatically when the containing EBA file is imported as an asset. However, by completing all of the manual steps that are described here, you can ensure that your web application bundle is configured correctly for your deployment environment.
To convert a WAR file to an OSGi web application bundle, complete the following steps:
  1. Change the file extension from .war to .jar.
  2. Define general bundle metadata by adding the following headers to the bundle manifest file, META-INF/MANIFEST.MF:
    Bundle-ManifestVersion
    The version of the syntax in which the bundle manifest file is written. For OSGi Service Platform Release 4, set the value to 2.
    Bundle-Name
    A human-readable name for the bundle.
    Bundle-SymbolicName
    A non-localizable name that identifies the bundle uniquely.
    Bundle-Version
    The version of the bundle. For more information, see the description of the Bundle-Version header in the bundle manifest file.
    Import-Package
    The external packages on which the bundle depends. For more information, see the description of the Import-Package header in the bundle manifest file.
    Export-Package
    The packages that are visible outside the bundle. For more information, see the description of the Export-Package header in the bundle manifest file.
  3. Define bundle-type-specific metadata by adding the following headers to the bundle manifest file:
    Export-EJB
    The presence of this header identifies the bundle as containing enterprise beans that are to be loaded and run by the EJB container. Optionally, you can specify, as the value of the this header, the list of enterprise beans that you want to export as OSGi services. For more information, see the description of the Export-EJB header in the bundle manifest file.
    Web-ContextPath
    The default context from which the web content is hosted.

    You must set the value of the Web-ContextPath header to the value of the <context-root> element for the corresponding web module in the application.xml file of the enterprise application EAR file.

  4. Specify the bundle classpath by adding a Bundle-Classpath header to the bundle manifest file.

    You must set the value of the Bundle-Classpath header to a comma-separated list of the names of all the JAR files and class subfolders that are contained in the WEB-INF/lib folder of the WAR file. Using a value of ./ can be an expensive operation. Making the path more explicit, for example by specifying WEB-INF/classes or WEB-INF/lib/acme.jar, rather than ./, can improve performance.

    For more information on the security implications of placing compiled source code outside of WEB-INF, see section 128.3.5 of the OSGi Service Platform Release 5 Enterprise Specification.