运行Pax考试时出现以下异常。我的配置仅包含来自文件系统的单个捆绑包,以及junit和felix。知道为什么会这样吗?

java.lang.IllegalStateException: Stream handler unavailable due to: null
    at org.apache.felix.framework.URLHandlersStreamHandlerProxy.openConnection(URLHandlersStreamHandlerProxy.java:311)
    at java.net.URL.openConnection(URL.java:945)
    at org.apache.felix.framework.cache.JarRevision.initialize(JarRevision.java:155)
    at org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:82)
    at org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:60)
    at org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:868)
    at org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:549)
    at org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:148)
    at org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:251)
    at org.apache.felix.framework.Felix.installBundle(Felix.java:2541)
    at org.apache.felix.framework.Felix.installBundle(Felix.java:2501)
    at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:150)
    at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:123)
    at org.ops4j.pax.exam.nat.internal.NativeTestContainer.installAndStartBundles(NativeTestContainer.java:319)
    at org.ops4j.pax.exam.nat.internal.NativeTestContainer.start(NativeTestContainer.java:163)
    at org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactor.invoke(AllConfinedStagedReactor.java:67)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner$2.evaluate(JUnit4TestRunner.java:284)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:93)


编辑:我正在使用Pax考试2.5.0,以下是我的配置方法。

@Configuration
public Option[] config() {
    return options(
            bundle("file:/home/nufail/mybundle.jar"),
            junitBundles(),
            felix().version("3.2.2")
    );
}

最佳答案

对于4.9.2版,通过将以下依赖项添加到maven解决了该问题。

<dependency>
   <groupId>org.ops4j.pax.exam</groupId>
   <artifactId>pax-exam-link-mvn</artifactId>
   <version>4.9.2</version>
   <scope>test</scope>
</dependency>

关于java - 运行Pax考试时出现IllegalStateException,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11880180/

10-11 00:15