Равноденствие не может разрешить org.eclipse.osgi.services и org.eclipse.equinox.cm - PullRequest
0 голосов
/ 11 ноября 2018

Я новичок в OSGI, и в настоящее время у меня возникла следующая проблема:

Я пытаюсь написать модуль OSGI с управляемой службой, которая должна возвращать строки приветствия на разных языках в зависимости от конфигурации. Я скачал 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.

1 Ответ

0 голосов
/ 11 ноября 2018

ManagedService находится в пакете org.osgi.service.cm (не org.eclipse.equinox.cm), который экспортирует плагин org.eclipse.osgi.services. Поэтому я думаю, что вы импортируете неправильные пакеты.

...