我正在尝试使用 Pax Exam 创建一个测试,其中我为测试加载的一些包依赖于包“ org.apache.felix.ipojo ”。
如果我要在 Pax Exam 配置中省略加载此捆绑包的行,例如:
@Configuration
public Option[] config() throws MalformedURLException{
return options(
junitBundles(),
BUNDLES OTHER THAN(org.apache.felix.ipojo),
...
然后我得到一个错误,表明这个包是一个缺少的依赖项:
ERROR: Bundle com.N.A [35] Error starting mvn:com.N/com.N.A (org.osgi.framework.BundleException: Unresolved constraint in bundle com.N.A [35]: Unable to resolve 35.0: missing requirement [35.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.felix.ipojo)(version>=1.8.0)))
org.osgi.framework.BundleException: Unresolved constraint in bundle com.N.A [35]: Unable to resolve 35.0: missing requirement [35.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.felix.ipojo)(version>=1.8.0))
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3826)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
at java.lang.Thread.run(Thread.java:662)
但是,如果我添加包含它的行:
@Configuration
public Option[] config() throws MalformedURLException{
return options(
junitBundles(),
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.ipojo")
...
我收到一条指示 ClassCastException 的消息,我认为这是由于 ipojo 捆绑包内置到 Felix 中造成的。
ERROR: Bundle org.apache.felix.ipojo [34] Error starting mvn:org.apache.felix/org.apache.felix.ipojo (org.osgi.framework.BundleException: Activator start error in bundle org.apache.felix.ipojo [34].)
java.lang.ClassCastException: org.apache.felix.ipojo.Extender cannot be cast to org.osgi.framework.BundleActivator
at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4177)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1972)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1895)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
at java.lang.Thread.run(Thread.java:662)
我正在使用 Felix 和 JUint4TestRunner 作为跑步者。
如何在没有冲突的情况下访问此依赖项?