Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Excerpt
hiddentrue

How to OSGi-fy a standard war file.

This page explains what it takes to make a standard war file deployable into OSGi. For detailed information read OSGi Service Platform Core Specification section 3.2 — Module Layer — Bundles. The pages specified bellow refers to Release 4, Version 4.1 April 2007.

...

Most likely the above headers will have to have the following values:

  • Bundle-ClassPath :
    • WEB_-INF/classes — this will find any class / file in WEB-INF/classes
    • lib/<dependency>.jar — you should have an entry for each jar you have in your lib directory, where <dependency> is the name of jar
      So, as an example the header can look like:
      Bundle-ClassPath: WEB-INF/classes,lib/commons-logging.jar,lib/spring.jar
  • Import-Package : should contain any package that your web application depends on but is not included into one of your dependencies that you listed in the Bundle-ClassPath header. Usually a war will not include J2EE apis:
    • javax.servlet - servlet api
    • javax.servlet.http - servlet api
      So, as an example the header can look like:
      Import-Package: javax.servlet,javax.servlet.http

...