2
votes

Disclaimer : I am complete newbie with OSGi in general and Felix in partciular. So apologize for any silly mistake I am making this time, but really appreciate if you can point out one.

I have downloaded Apache Felix v4.2.1 and started running it as described in guide at http://felix.apache.org/documentation/subprojects/apache-felix-framework/apache-felix-framework-usage-documentation.html

Also followed the given tutorials to develop sample service listener bundle, dictionary bundle, and dictionary client (ref : http://felix.apache.org/documentation/tutorials-examples-and-presentations/apache-felix-osgi-tutorial/apache-felix-tutorial-example-1.html)

I was able to successfully install and start them in Felix using felix:start command. Following is the output of felix:lb command,

START LEVEL 1
   ID|State      |Level|Name
    0|Active     |    0|System Bundle (4.2.1)
    1|Active     |    1|Apache Felix Bundle Repository (1.6.6)
    2|Active     |    1|Apache Felix Gogo Command (0.12.0)
    3|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
    4|Active     |    1|Apache Felix Gogo Shell (0.10.0)
    5|Active     |    1|file:/home/dev/experiments/osgi/workspace/FirstProj/dist/firstproj.jar (0.0.0)
    6|Active     |    1|file:/home/dev/experiments/osgi/workspace/SecondProj/dist/dictionary.jar (0.0.0)
    7|Active     |    1|file:/home/dev/experiments/osgi/workspace/ThirdProj/dist/dictionary_client.jar (0.0.0)

However neither of my bundles output anything on console and the 7th bundle (dicionary_client) is also expected to ask for input (using System.in), which is also not working.

It must be some small configuration / execution mistake, but really appreciate if you guys can point me in the right direction.

Thanks.

1

1 Answers

0
votes

I figured out the problem. The bundles were not getting installed correctly because their corresponding jar files did not have META-INF directory entry.

They had META-INF/MANIFEST.MF but it looks like Felix requires META-INF directory in jar's directory structure (it might be using getResource method to keep handle of META-INF directory).

Eclipse's export jar does not create such entry (even though Add Directories option is selected). So I manually built the jars and they are working.