簡體   English   中英

Equinox 無法解析 org.eclipse.osgi.services 和 org.eclipse.equinox.cm

[英]Equinox can´t resolve org.eclipse.osgi.services and org.eclipse.equinox.cm

我是 OSGI 的新手,目前遇到以下問題:

我正在嘗試編寫一個帶有托管服務的 OSGI 模塊,該模塊應該根據配置返回不同語言的 hello world 字符串。 我已經下載了 Equinox 並將其添加到我的 Eclipse IDE 中的首選項/插件開發/目標平台/內容下。 當我嘗試在 MANIFEST.ML 中導入我需要的包時

Import-Package: org.osgi.framework;version="1.3.0", org.eclipse.equinox.cm, org.eclipse.osgi.services

Eclipse 警告我沒有可用的包導出這些包(我在首選項/插件開發/目標平台/下勾選了它們),即使 Eclipse 識別了像 ManagedService 這樣的類。 無論如何,當我嘗試運行該項目時,我得到以下輸出:

WARNING: Using incubator modules: jdk.incubator.httpclient
Hello World
!SESSION 2018-11-11 17:34:31.981 -----------------------------------------------
eclipse.buildId=unknown
java.version=9.0.4
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_AT
Command-line arguments:  -dev file:C:/Users/SpaceLama/eclipse-workspace/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog -console

!ENTRY HelloWorld 4 0 2018-11-11 17:34:32.505
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: HelloWorld [33]
  Unresolved requirement: Import-Package: translator
    -> Export-Package: translator; bundle-symbolic-name="Translator"; bundle-version="1.0.0.qualifier"; version="0.0.0"
       Translator [69]
         Unresolved requirement: Import-Package: org.eclipse.equinox.cm

    at org.eclipse.osgi.container.Module.start(Module.java:447)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1685)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1665)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1627)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1558)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:233)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:343)

!ENTRY org.eclipse.osgi.services 4 0 2018-11-11 17:34:32.552
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.osgi.services [61]
  Unresolved requirement: Import-Package: javax.servlet; resolution:="optional"
  Unresolved requirement: Import-Package: javax.servlet.http; resolution:="optional"
  Unresolved requirement: Import-Package: org.osgi.util.function; version="[1.0.0,2.0.0)"

    at org.eclipse.osgi.container.Module.start(Module.java:447)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1685)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1665)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1627)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1558)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:233)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:343)

!ENTRY Translator 4 0 2018-11-11 17:34:32.552
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: Translator [69]
  Unresolved requirement: Import-Package: org.eclipse.equinox.cm

    at org.eclipse.osgi.container.Module.start(Module.java:447)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1685)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1665)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1627)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1558)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:233)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:343)

!ENTRY org.eclipse.osgi 4 0 2018-11-11 17:34:32.552
!MESSAGE Bundle initial@reference:file:../../eclipse-workspace/HelloWorld/ was not resolved.

!ENTRY org.eclipse.osgi 4 0 2018-11-11 17:34:32.552
!MESSAGE Bundle initial@reference:file:../../eclipse-workspace/Translator/ was not resolved.

!ENTRY org.eclipse.osgi 4 0 2018-11-11 17:34:32.552
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.osgi.services_3.7.100.v20180827-1536.jar was not resolved.

ManagedService似乎在org.osgi.service.cm包(不是org.eclipse.equinox.cm )中,由org.eclipse.osgi.services插件導出。 所以我認為你導入了錯誤的包。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM