【问题标题】:OSGi in saaj environment [duplicate]saaj环境中的OSGi [重复]
【发布时间】:2018-06-07 00:56:11
【问题描述】:

在我的本地环境中,我使用“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】:

    经过进一步研究,我找到了适合我情况的解决方案。 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”放在同一个文件夹中。那是我环境中的插件文件夹。

    • 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

    【讨论】:

    • 您不应该在生产环境中使用 telnet shell,因为它非常不安全:它允许任何黑客在您的机器上运行任意代码。而是使用 Felix Gogo shell 提供的 ssh 工具:stackoverflow.com/questions/30590137/…
    猜你喜欢
    • 2023-03-18
    • 1970-01-01
    • 2014-09-04
    • 1970-01-01
    • 2012-06-25
    • 1970-01-01
    • 1970-01-01
    • 2017-05-07
    • 2017-04-20
    相关资源
    最近更新 更多