已解决所需捆绑包的状态而非活动状态

时间:2013-03-18 11:01:33

标签: java osgi equinox bnd

我有一个依赖于bundle B的bundle A.当bundle A中的代码运行并从bundle B访问一个类时,bundle B的状态被解析(4)而不是active(32)和bundle B的激活器运行不好。我认为捆绑B的清单有些不对劲但我无法发现它。

这是B组的清单,用bnd生成。

Manifest-Version: 1.0
Export-Package: org.jboss.logging;uses:="org.osgi.framework,org.eclips
 e.equinox.log,org.jboss.logmanager,org.apache.log4j,org.slf4j.spi,org
 .slf4j";version="3.2.0.Beta1-SNAPSHOT"
Build-Timestamp: Sun, 17 Mar 2013 15:07:31 +0100
Tool: Bnd-0.0.357
Bundle-Name: JBoss Logging 3
Created-By: 1.7.0_10 (Oracle Corporation)
Bundle-Vendor: JBoss by Red Hat
Scm-Revision: 9e799bac390dbbf9c7cd55afe93dff9265fbed05
Bundle-Version: 3.2.0.Beta1-SNAPSHOT
Bnd-LastModified: 1363529254048
Bundle-ManifestVersion: 2
Bundle-Activator: org.jboss.logging.Activator
Bundle-Description: The JBoss Logging Framework
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-SymbolicName: org.jboss.logging.jboss-logging
Import-Package: org.apache.log4j;resolution:=optional,org.eclipse.equi
 nox.log;resolution:=optional;version="1.0",org.jboss.logging;version=
 "3.2",org.jboss.logmanager;resolution:=optional,org.osgi.framework;ve
 rsion="1.7",org.slf4j;resolution:=optional;version="1.6",org.slf4j.sp
 i;resolution:=optional;version="1.6"
Bundle-DocURL: http://www.jboss.org

这是用PDE生成的捆绑包A的清单。

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Sample-view
Bundle-SymbolicName: sample-view; singleton:=true
Bundle-Version: 1.0.0.qualifier
Require-Bundle: org.eclipse.core.runtime,
 org.eclipse.ui,
 org.jboss.logging.jboss-logging
Bundle-RequiredExecutionEnvironment: JavaSE-1.7

1 个答案:

答案 0 :(得分:3)

叹息。我打赌你在Equinox上运行。在他们永恒的智慧中,Eclipse家伙决定不开始捆绑,担心它会使系统超载。试图在Eclipse中启动捆绑包非常复杂。但是,在您的情况下,有一个简单的解决方案:OSGi激活策略。这将在加载第一个类时启动您的包。只需添加到B

Bundle-ActivationPolicy: lazy