2015-06-17 2 views
1

Я пытаюсь расширить правило в плагине PMD Eclipse через фрагмент плагина. Когда я пытаюсь проверить свой код, я получаю эту ошибку, которая, по-видимому, вызвана одним из проектов зависимостей моего плагина.Исключение пакета OSGI, вызванное «применением ограничений ограничений»

!ENTRY net.sourceforge.pmd.eclipse.plugin 4 0 2015-06-17 09:30:10.972 
!MESSAGE FrameworkEvent ERROR 
!STACK 0 
org.osgi.framework.BundleException: Could not resolve module: net.sourceforge.pmd.eclipse.plugin [1086] 
    Bundle was not resolved because of a uses contraint violation. 
    org.osgi.service.resolver.ResolutionException: Uses constraint violation. Unable to resolve resource net.sourceforge.pmd.eclipse.plugin [osgi.identity; osgi.identity="net.sourceforge.pmd.eclipse.plugin"; type="osgi.bundle"; version:Version="4.0.7.v20150522-1709"; singleton:="true"] because it exports package 'org.apache.log4j' and is also exposed to it from resource org.apache.log4j [osgi.identity; osgi.identity="org.apache.log4j"; type="osgi.bundle"; version:Version="1.2.15.v201012070815"] via the following dependency chain: 

    net.sourceforge.pmd.eclipse.plugin [osgi.identity; osgi.identity="net.sourceforge.pmd.eclipse.plugin"; type="osgi.bundle"; version:Version="4.0.7.v20150522-1709"; singleton:="true"] 
    require: (&(osgi.wiring.bundle=de.fu_berlin.inf.archnemesis)(bundle-version>=1.0.0)) 
    | 
    provide: osgi.wiring.bundle; osgi.wiring.bundle="de.fu_berlin.inf.archnemesis"; bundle-version:Version="1.0.0.qualifier"; singleton:="true" 
    org.eclipse.xtext.util [osgi.identity; osgi.identity="org.eclipse.xtext.util"; type="osgi.bundle"; version:Version="2.8.3.v201506010551"] 
    import: (&(osgi.wiring.package=org.apache.log4j)(version>=1.2.15)) 
    | 
    export: osgi.wiring.package: org.apache.log4j 
    org.apache.log4j [osgi.identity; osgi.identity="org.apache.log4j"; type="osgi.bundle"; version:Version="1.2.15.v201012070815"] 
    at org.eclipse.osgi.container.Module.start(Module.java:434) 
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582) 
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561) 
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533) 
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476) 
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) 
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) 
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) 

Может ли кто-нибудь декодировать, что означает это сообщение об ошибке, и как его исправить?

ответ

1

Я думаю, что проблема связана с Require-Bundle директивы в net.sourceforge.pmd.eclipse.plugin пучке в сочетании с Export-Package директивы для org.apache.log4j (это более или менее просто rephrasal сообщения об ошибке ФЕЛИКС).

Требуемый пакет de.fu_berlin.inf.archnemesis импортирует log4j, и в то же время et.sourceforge.pmd.eclipse.plugin имеет лог44j в своем пути к классам (поскольку он экспортирует его, это то, что сообщение об ошибке, которое оно вам сообщает). Это приводит к дублированию пакета org.apache.log4j и вызывает ошибку.

Попробуйте удалить комплект org.apache.log4j из вашей среды выполнения, чтобы позволить de.fu_berlin.inf.archnemesis решить log4 от net.sourceforge.pmd.eclipse.plugin.

Читайте также this post о Решение OSGi «Использует» Нарушения ограничений от Neil Bartlett: Мне было очень интересно.

Смежные вопросы