OSGi运行时中的Commons日志包

OSGi运行时中的Commons日志包,osgi,slf4j,equinox,apache-commons-logging,Osgi,Slf4j,Equinox,Apache Commons Logging,我目前正在尝试在春分开始捆绑销售 此捆绑包需要commons日志记录 我试着包括来自Maven Central的最新commons日志jar。不走运 然后我搬到了slf4j。这是我在OSGi控制台的当前状态: 11 ACTIVE jcl.over.slf4j_1.6.6 12 ACTIVE slf4j.api_1.6.6 Fragments=14 14 RESOLVED slf4j.simple_1.

我目前正在尝试在春分开始捆绑销售

此捆绑包需要commons日志记录

我试着包括来自Maven Central的最新commons日志jar。不走运

然后我搬到了slf4j。这是我在OSGi控制台的当前状态:

11      ACTIVE      jcl.over.slf4j_1.6.6
12      ACTIVE      slf4j.api_1.6.6
                    Fragments=14
14      RESOLVED    slf4j.simple_1.6.6
                    Master=12
在日志中,我看到以下异常:

!ENTRY org.eclipse.osgi 4 0 2012-07-09 11:36:56.157
!MESSAGE Error starting bundle: initial@file:/C:/test/slf4j-simple-1.6.6.jar
!STACK 0
org.osgi.framework.BundleException: A fragment bundle cannot be started: slf4j.simple_1.6.6 [14]
    at org.eclipse.osgi.framework.internal.core.BundleFragment.startWorker(BundleFragment.java:224)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startBundle(EclipseStarter.java:1119)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startBundles(EclipseStarter.java:1112)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.loadBasicBundles(EclipseStarter.java:631)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:277)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.main(EclipseStarter.java:151)

!ENTRY org.eclipse.osgi 4 0 2012-07-09 11:36:56.205
!MESSAGE Bundle slf4j.simple_1.6.6 [14] is not active.

在Equinox 3.8中建立并运行commons日志兼容包的最佳方法是什么

slf4j simple
是一个片段,无法启动片段


您是否在config.ini中列出了它,并在末尾添加了
@start
?只需将其从OSGi服务平台核心规范中删除。

A Fragment bundle must enter the resolved state only if it has been successfully
attached to its host bundle.

All class or resource loading of a fragment is handled through the host’s
class loader, a fragment must never have its own class loader. Fragment bundles
are treated as if they are an intrinsic part of their host.
很多时候,我们启动片段束,然后导致
org.osgi.framework.BundleException:无法启动片段束异常。

根据规范,不需要启动片段束。这不是代码的问题