天天看點

安裝Apache Felix OSGI Framework小記

    Felix是apache的開源OSGI服務架構,到 http://felix.apache.org/downloads.cgi 可以下載下傳到最新的版本。

    解壓後目錄結構如下:

    felix-framework-4.2.1

        -bin

        -bundle

        -conf

        -doc

    bin目錄下是felix.jar

    bundle下面的bundle會在啟動時自動安裝

    conf下面是配置檔案

    1. 啟動felix

         啟動指令行,并定位到安裝目錄,

         執行 java -jar ./bin/felix.jar 這會使用預設的配置,如果需指定另一個配置檔案,則要

         執行java -Dfelix.config.properties=file:./conf/config.properties -jar ./bin/felix.jar

         執行成功,我們會看到felix的 gogo已經可以使用,這是felix的shell.

     2.  執行lb可以列出目前的bundle的狀态

          install file:./bundle/***.jar

          start bundleID

          這樣就可以安裝和啟動一個bundle了

     3. 安裝http服務和felix控制台bundle

          http://felix.apache.org/documentation/subprojects/apache-felix-http-service.html#installing   這是http的詳細介紹

  • org.apache.felix.http.jetty - HTTP Service implementation that is embedding Jetty server.
  • org.apache.felix.http.whiteboard - Whiteboard implementation that uses any HTTP Service implementation.
  • org.apache.felix.http.bridge - HTTP Service implementation that uses the host applicaiton server (bridged mode). Must be used with proxy.
  • org.apache.felix.http.bundle - All in one bundle that includes all of the above.
  • org.apache.felix.http.proxy - Proxy that is needed inside WAR when deployed inside an application server.

       這裡說隻要org.apache.felix.http.bundle就可以了,我試了下,發現隻安裝這個仍然不行,還是要安裝org.apache.felix.http.jetty        安裝了jetty後,localhost:8080才能通路        在下載下傳頁面下載下傳Web Console (all-in-one bundle) 并安裝這個bundle,之後通過        localhost:8080/system/console 就可以通路felix的控制台了。