さて、前回は GlassFish V3 Prelude を Eclipse Equinox 上で動かす方法でしたが、今回はもともと使っている Apache Felix の OSGi 実行環境を見てみます。

OSGi の環境をいろいろ試すには、felix shell を使いたいので、この環境をセットアップします。 GlassFish V3 Prelude は、前回同様 /home/shioda/glassfishv3-prelude にインストールされていることを前提とします。まずエディタで /home/shioda/glassfishv3-prelude/glassfish/felix/conf/config.properties ファイルを開いてみてください。38行目から FELIX SHELL を使うには云々という説明が書いてありますが、簡単にいうと

${com.sun.aas.installRootURI}/felix/bundle/org.apache.felix.shell.jar \
${com.sun.aas.installRootURI}/felix/bundle/org.apache.felix.shell.remote.jar
この2行を felix.auto.start.1 の最後に追加しろということです。felix.auto.start.1 は次のようになります。
felix.auto.start.1= \
 ${com.sun.aas.installRootURI}/modules/javax.xml.stream.jar \
 ${com.sun.aas.installRootURI}/modules/tiger-types-osgi.jar \
 ${com.sun.aas.installRootURI}/modules/auto-depends.jar \
 ${com.sun.aas.installRootURI}/modules/config.jar \
 ${com.sun.aas.installRootURI}/modules/hk2-core.jar \
 ${com.sun.aas.installRootURI}/modules/osgi-adapter.jar \
 ${com.sun.aas.installRootURI}/felix/bundle/org.apache.felix.shell.jar \
 ${com.sun.aas.installRootURI}/felix/bundle/org.apache.felix.shell.remote.jar
あとはこの数行下に osgi.shell.telnet.port=6666 という設定があるのがわかると思います。これは FELIX SHELL に接続するポートになります。特に問題なければそのままにしておきましょう。他のアプリケーションでこのポートを使っている場合は値を変更してください。

さて、この設定が終わったらアプリケーションサーバーを起動します。

% /home/shioda/glassfishv3-prelude/glassfish/bin/asadmin start-domain --verbose
GlassFish が起動したら、他の端末からポート 6666 にアクセスしてみましょう。
% telnet localhost 6666
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Felix Shell Console:
=====================

-> help
bundlelevel   ... |  - set or get bundle start level.
cd []                     - change or display base URL.
headers [ ...]                  - display bundle header properties.
help                                - display impl commands.
install  [ ...]           - install bundle(s).
packages [ ...]                 - list exported packages.
ps [-l | -s | -u]                   - list installed bundles.
refresh [ ...]                  - refresh packages.
resolve [ ...]                  - attempt to resolve the specified bundles.
services [-u] [-a] [ ...]       - list registered or used services.
shutdown                            - shutdown framework.
start  [  ...]         - start bundle(s).
startlevel []                - get or set framework start level.
stop  [ ...]                - stop bundle(s).
uninstall  [ ...]           - uninstall bundle(s).
update  []                 - update bundle.
version                             - display version of framework.
->
ぜひ皆さんもお試しください。
投稿されたコメント:

コメント
  • HTML文法 不許可

This blog copyright 2008 by shioda