The manifest includes one final header that's specific to WAB s and defines the web
context root. This header is required for a bundle to be recognized as a WAB . Many
enterprise OSG i implementations also allow the context root to be changed after
Build these three files into a JAR , and the web application is ready to try out!
Deploying and testing
Because OSG i is so dynamic, testing OSG i bundles is pretty easy. The same bundle can
be loaded repeatedly without having to stop or start anything else. If you're as prone
to typos as the authors, you'll find this extremely handy.
THE LOAD DIRECTORY
The Apache Aries runtime you assembled earlier includes Felix File Install, which pro-
vides a simple mechanism for discovering and starting new applications. The target
directory includes a folder called load (if the load directory isn't there, you can add it
yourself). Any OSG i bundles copied into this directory will automatically be started.
To try this out, start the Aries runtime using
java -jar org.eclipse.osgi-3.7.0.v20110613.jar -console -clean
Type ss to see the list of installed bundles. Now copy the web bundle you've built into
the load directory. You'll see a bunch of output scroll by in the OSG i console. Type ss
again. You'll see a new bundle is listed, the fancyfoods.web bundle you copied into
the load directory. This new bundle should be in ACTIVE state.
All that remains now is to try it out. Point a browser at http://localhost:8080/
fancyfoods.web/SayHello. You'll see more debug output scroll by in the OSG i console,
and the browser should display a response like the one shown in figure 2.5.
What if nothing happens?
Our sandbox uses Apache Felix's File Install bundle to install bundles that we drop
into the load directory. This is quick and easy, but it's also quiet when there's a fail-
ure. It's quite common for nothing to be output at all. If you don't see anything hap-
pen when you drop your bundle into the load directory, don't panic. You can use one
of the other Equinox console commands to find out what's gone wrong.
The install command allows users to install a bundle from a particular URL. In your
case, you want to point at the fancyfoods.web_1.0.0.jar , and need to run the fol-
This command will almost certainly generate a useful error. Typically the error will in-
dicate that the bundle's manifest is malformed, often because there aren't any "
characters around a version range. Whatever the error is, it should provide enough
information to help you fix the problem and continue on with the example.
Search WWH ::