2012-08-09 117 views
2

運行Pax考試時出現以下異常。我的配置只包含來自文件系統的單一捆綁軟件,僅包含junit和felix。任何想法爲什麼發生這種情況運行Pax考試時出現IllegalStateException異常考試

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") 
    ); 
} 
+0

這是非常困難的,幫助沒有看到你的代碼。你可以發佈一些嗎? – Dahaka 2012-08-09 09:22:21

+0

需要關於這一個的更多信息:您正在使用哪種Pax考試版本? 您正在使用Felix的Native Container,您是否可以提供更多的配置部分(@Configuration)? – 2012-08-09 14:15:37

+0

doublecheck with http://stackoverflow.com/questions/5127969/pax-url-protocol-not-supported-at-felixs-startup/5731293#5731293 – 2012-08-09 14:23:22

回答

0

對於版本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>