As mentioned above, a standard WAR file typically packages of all its
. The servlet container will
then add all of the JARs in
to the application’s
The first step of the migration towards benefiting from an OSGi container is to retrieve the dependencies from the VTS’s bundle repository at runtime. This can significantly reduce the time it takes to build and deploy the application. It also enables the enforcement of policies regarding the use of third-party libraries.
The way in which dependencies are declared in an OSGi environment is
via manifest headers in a bundle’s
As mentioned in
Chapter 4, Developing Applications
, there are
three ways of expressing dependencies:
The Form Tags application uses JSTL standard tag libraries.
need to choose a JSTL provider, for example the
which comes with the VTS. To use the
implementation of JSTL, you need to express your dependency
outlined in the following manifest listing.
Because it is a single
the simplest and therefore preferred manifest header to use.
The Form Tags application requires commons-logging and Spring.
would be very painful to have to list all the Spring packages one by
Equally, considering the number of bundles that make up the
Spring framework, it would be verbose to list each bundle. Therefore
is the preferred approach
for expressing the dependency on the Spring
How do you determine the name of a library definition provided by the Virgo Server for Apache Tomcat? Use the SpringSource Enterprise Bundle Repository .
Manifest-Version: 1.0 Ant-Version: Apache Ant 1.7.0 Created-By: 1.5.0_13-119 (Apple Inc.) Bundle-ManifestVersion: 2 Bundle-SymbolicName: org.springframework.showcase.formtags-shared-libs Import-Library: org.springframework.spring;version="[3.0.0,4.0.0)" Import-Bundle: com.springsource.org.apache.taglibs.standard;version="1 .1.2"
You can see the
directives that instruct the VTS to add the
appropriate package imports to the bundle
classpath used by this WAR file.
Deploying the shared libraries WAR onto the VTS should result in console output similar to the following:
The console output has been reformatted to fit this document.
[2009-07-01 15:00:14.953] fs-watcher <SPDE0048I> Processing 'CREATED' event for file 'formtags-shared-libs-3.0.0.RELEASE.war'. [2009-07-01 15:00:15.363] fs-watcher <SPDE0010I> Deployment of 'org.springframework.showcase.formtags_shared_libs' version '2' completed. [2009-07-01 15:00:15.364] Thread-20 <SPWE0000I> Starting web bundle '/formtags-shared-libs-3.0.0.RELEASE'. [2009-07-01 15:00:15.816] Thread-20 <SPWE0001I> Started web bundle '/formtags-shared-libs-3.0.0.RELEASE'.
should render the welcome page. Note that for the pre-packaged
should be similar to
whereas, for a local build the
may be completely
omitted. Please consult the console output,
web-based admin console, or log
to determine the exact context path
under which the web application has been deployed.