在saaj环境中的OSGi [重复]

问题描述 投票:0回答:1

这个问题在这里已有答案:

在我的本地环境中,我使用“start.bat”文件来启动应用程序包。

这如下所示:

java -jar -ea -Declipse.ignoreApp=true -Dosgi.clean=true -Ddebug=true plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar -console -noExit

OSGi通过列出现有插件的方式在命令提示符下启动。然而,生产将是一个saaj环境,我认为通过安装流程管理器包启动OSGi作为后台进程。然后我的问题是如何监控它?如何启动或停止捆绑?我是否需要使用一些监控工具(如Apache Felix Web控制台)才能进行telnet连接?在云服务器上有一种简单的方法(或常见用法)吗?有人可以告诉我这个问题,因为我是OSGi概念的新手吗?

osgi jconsole saaj
1个回答
0
投票

经过一些进一步的研究,我找到了适合我情况的解决方案。 eclipse equinox的“-console”选项(相当于“osgi.console”)接受主机和端口参数。所以我改变了我的启动脚本如下(只添加了端口号):

java -jar -ea -Declipse.ignoreApp=true -Dosgi.clean=true -Ddebug=true plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar -console 5555 -noExit

但是,此附加配置需要一些额外的库和OSGi配置更改。我不得不将以下jar文件放在“org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar”的同一文件夹中。那是我环境中的plugins文件夹。

  • org.apache.felix.gogo.command_0.10.0.v201209301215.jar
  • org.apache.felix.gogo.runtime_0.10.0.v201209301036.jar
  • org.apache.felix.gogo.shell_0.10.0.v201212101605.jar
  • org.eclipse.equinox.console_1.1.0.v20140131-1639.jar

其次,我配置了config.ini文件。它应包含以下键/值:

osgi.bundles=org.eclipse.equinox.console@start, org.apache.felix.gogo.command@start, org.apache.felix.gogo.shell@start, org.apache.felix.gogo.runtime@start
osgi.noShutdown=true
eclipse.ignoreApp=true

在这些更改之后,我可以通过简单地使用到给定端口的telnet连接从命令行将命令传递到OSGi运行时。一个棘手的问题是,即使你终止了你的ssh连接,OSGi也会一直运行,直到你通过输入'exit'来确定OSGi控制台。

参考:OSGi Modularity - Tutorial

© www.soinside.com 2019 - 2024. All rights reserved.