简体   繁体   English

Eclipse Juno上的独立OSGi(Equinox)服务器

[英]Standalone OSGi (Equinox) server on Eclipse Juno

I'm trying to get the osgi server from the Eclipse Juno Release and run it standalone. 我正在尝试从Eclipse Juno Release获取osgi服务器并单独运行它。 Some old tutorials say that just grabbing the org.eclipse.osgi_VERSION.jar is enough to start it from the command line as 一些旧的教程说只需抓住org.eclipse.osgi_VERSION.jar即可从命令行启动它

java -jar  org.eclipse.osgi_VERSION.jar -console

When I try that, it doesn't show the prompt as expected, but instead sits quietly as if waiting for something to happen. 当我尝试时,它没有按预期显示提示,而是静静地坐着,好像在等待某事发生。

However, I can comfortably start and install bundles by doing a ./eclipse -console , which obviously isn't an option when running on the server, where I want to deploy bundles at runtime. 但是,我可以通过执行./eclipse -console来轻松启动和安装bundle。在服务器上运行时,这显然不是一个选项,我想在运行时部署bundle。

Some googling revealed I need to gather up jars (even Apache Felix's gogo) from here and there, but couldn't find anything concrete that would allow me to run this thing in a "headless" fashion. 一些谷歌搜索显示我需要从这里和那里收集罐子(甚至Apache Felix的gogo),但找不到任何具体的东西,这将允许我以“无头”的方式运行这件事。

Is there a way to do this in a clean and simple way, or would you suggest shifting to Apache Felix? 有没有办法以干净简单的方式做到这一点,或者你建议转移到Apache Felix?

Equinox in Juno does no longer contain the console out of the box. Juno中的Equinox不再包含开箱即用的控制台。 It's now contained in a separate bundle which implements the Equinox console on top of the Apache GoGo shell. 它现在包含在一个单独的包中,该包在Apache GoGo shell之上实现Equinox控制台。

Thus, the minimum setup of bundles for running Equinox including the console is: 因此,运行Equinox( 包括控制台 )的捆绑包的最小设置是:

  • org.eclipse.osgi org.eclipse.osgi
  • org.eclipse.equinox.console org.eclipse.equinox.console
  • org.apache.felifx.gogo.command org.apache.felifx.gogo.command
  • org.apache.felifx.gogo.runtime org.apache.felifx.gogo.runtime
  • org.apache.felifx.gogo.shell org.apache.felifx.gogo.shell

For running the SSH console one also needs: 要运行SSH控制台,还需要:

  • org.eclipse.equinox.console.ssh org.eclipse.equinox.console.ssh
  • org.apache.mina.core org.apache.mina.core
  • org.apache.sshd.core org.apache.sshd.core

Additionally, you need to use a different configuration area . 此外,您需要使用不同的配置区域 Equinox reads settings (like what bundles to use, their start levels, what application to start, etc.) from the config.ini. Equinox从config.ini读取设置(如要使用的包,启动级别,启动应用程序等)。 Thus, as along as you use the same configuration area as Juno you'll always end up in your Juno environment. 因此,当您使用与Juno相同的配置区域时,您将始终最终进入Juno环境。 You may corrupt your Juno installation when modifying the config.ini directly. 直接修改config.ini时,可能会损坏Juno安装。

A better start is to download the Equinox Juno OSGi starter kit: 更好的开始是下载Equinox Juno OSGi入门套件:

You can also try one of the OSGi Equinox server distributions: 您还可以尝试其中一个OSGi Equinox服务器发行版:

Try this: 试试这个:

java -classpath ./plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
    org.eclipse.equinox.launcher.Main -console

You should try Apache karaf. 你应该尝试Apache karaf。 It can run with Felix or Equinox and contains everything you need for a decent OSGi server. 它可以与Felix或Equinox一起运行,并包含一个体面的OSGi服务器所需的一切。 See http://karaf.apache.org/ http://karaf.apache.org/

This link provides all the details regarding the new console which is based on Apache Felix Gogo shell: http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fconsole_shell.htm 此链接提供有关基于Apache Felix Gogo shell的新控制台的所有详细信息: http//help.eclipse.org/juno/index.jsp? topic =%2Forg.eclipse.platform.doc.isv% 2Fguide% 2Fconsole_shell.htm

In short steps are: 简而言之就是:

  1. Place the necessary bundles in a folder. 将必要的捆绑包放在一个文件夹中。 The bundles are: org.apache.felix.gogo.command_0.8.0v.jar org.apache.felix.gogo.runtime_0.8.0v.jar org.apache.felix.gogo.shell_0.8.0v.jar org.eclipse.equinox.console_1.0.0v.jar org.eclipse.osgi.jar 这些包是:org.apache.felix.gogo.command_0.8.0v.jar org.apache.felix.gogo.runtime_0.8.0v.jar org.apache.felix.gogo.shell_0.8.0v.jar org.eclipse。 equinox.console_1.0.0v.jar org.eclipse.osgi.jar

  2. Create a configuration subfolder and a config.ini file with the following content 使用以下内容创建配置子文件夹和config.ini文件

    osgi.bundles=./org.apache.felix.gogo.runtime_0.8.0v.jar@start,\\ ./org.apache.felix.gogo.command_0.8.0v.jar@start,\\ ./org.apache.felix.gogo.shell_0.8.0v.jar@start,\\ ./org.eclipse.equinox.console.jar@start,\\ osgi.console.enable.builtin=false osgi.bundles =。/ org.apache.felix.gogo.runtime_0.8.0v.jar@start, \\ ./org.apache.felix.gogo.command_0.8.0v.jar@start, \\ ./org.apache。 felix.gogo.shell_0.8.0v.jar@start, \\ ./org.eclipse.equinox.console.jar@start,,osgi.console.enable.builtin = false

  3. Start the Equinox framework with the below command: java -jar org.eclipse.osgi.jar 使用以下命令启动Equinox框架:java -jar org.eclipse.osgi.jar

To run with the old console, you can invoke: 要使用旧控制台运行,您可以调用:

java -Dosgi.console.enable.builtin=true -jar org.eclipse.osgi_VERSION.jar -console

Note that this is using the old (non-Gogo implementation) and the built-in console is likely to be removed at some point. 请注意,这是使用旧的(非Gogo实现),并且内置控制台很可能在某些时候被删除。 However, you should consider running with the Gogo shell instead, which is the de-facto standard for future Eclipse and Felix versions. 但是,您应该考虑使用Gogo shell,这是未来Eclipse和Felix版本的事实标准。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM