Apache Karaf 在关闭 Pax-Exam 时卡住了

Apache Karaf stuck while shutting with Pax-Exam

我正在 运行使用 Pax-Exam 和 Karaf 进行集成测试,测试已成功执行,但在关闭 Karaf 时,它卡在下面并且永远不会恢复

Pax-考试 = 4.11 卡拉夫 = 4.2

[main] DEBUG o.ops4j.store.intern.TemporaryStore - Exit store(): 66cf6a516d0d1a670e78bd6b0be97f3da2a380b3
[main] DEBUG o.o.p.e.c.remote.RBCRemoteTarget - Preparing and Installing bundle (from stream )..
[main] DEBUG o.o.p.e.r.c.RemoteBundleContextClient - Packing probe into memory for true RMI. Hopefully things will fill in..
[main] DEBUG o.o.p.e.c.remote.RBCRemoteTarget - Installed bundle (from stream) as ID: 86
[main] DEBUG o.o.p.e.c.remote.RBCRemoteTarget - call [[TestAddress:PaxExam-bc970a6c-c656-4aa6-9300-35ded2bcde50 root:PaxExam-f6737e31-8f28-43e
0-847e-1f3f49649233]]
[main] DEBUG o.o.p.e.k.c.i.KarafTestContainer - Shutting down the test container (Pax Runner)

以下是用于阻塞的 JConsole 的输出

Name: main
State: BLOCKED on java.lang.Object@d53a0bb owned by: KarafJavaRunner
Total blocked: 106  Total waited: 105

Stack trace: 
org.ops4j.pax.exam.karaf.container.internal.runner.InternalRunner.shutdown(InternalRunner.java:71)
org.ops4j.pax.exam.karaf.container.internal.runner.KarafJavaRunner.shutdown(KarafJavaRunner.java:120)
   - locked org.ops4j.pax.exam.karaf.container.internal.runner.KarafJavaRunner@279baf5b
org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.stop(KarafTestContainer.java:600)
   - locked org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer@25dcfa62
org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactor.invoke(AllConfinedStagedReactor.java:87)
org.ops4j.pax.exam.junit.impl.ProbeRunner.evaluate(ProbeRunner.java:267)
org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
org.junit.runners.ParentRunner.run(ParentRunner.java:238)
org.junit.runners.ParentRunner.schedule(ParentRunner.java:63)
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
org.junit.runners.ParentRunner.access[=11=]0(ParentRunner.java:53)
org.junit.runners.ParentRunner.evaluate(ParentRunner.java:229)
org.junit.runners.ParentRunner.run(ParentRunner.java:309)
org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:98)
org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

更新: 我观察到的另一件事是,如果我强行关闭它,然后如果我 运行 "mvn clean install" 我得到以下错误,我必须等待再次 运行

[←[1;31mERROR←[m] Failed to execute goal ←[32morg.apache.maven.plugins:maven-clean-plugin:2.5:clean←[m ←[1m(default-clean)←[m on project ←[36mosgi-unit-tes
ts-sample←[m: ←[1;31mFailed to clean project: Failed to delete C:\Users\..\target\pax
exam\e266ddcb-5fed-4997-8178-3d4944251418\system\org\apache\felix\org.apache.felix.framework.6.10\org.apache.felix.framework-5.6.10.jar←[m -> ←[1m[Help 1

更新 2:

退出提示符后仍然是运行ning

C:\Program Files\Java\jdk1.8.0_162\bin>jps -l
1552 sun.tools.jps.Jps
4144
1420 org.apache.karaf.main.Main

C:\Program Files\Java\jdk1.8.0_162\bin>jps -l 1420
RMI Registry not available at 1420:1099
Exception creating connection to: 1420; nested exception is:
        java.net.SocketException: Network is unreachable: connect

更新3: 如果我终止这个进程,Pax 恢复并显示消息成功执行测试。事实上,在关闭之前所有测试都已经成功,但无法关闭。

 TASKKILL /F /PID 10692

现在我不知道如何处理这个锁定问题。

更新4: 姓名:主要 状态:等待 org.apache.felix.framework.util.ThreadGate@b3d26d8 阻止总数:6 等待总数:7

堆栈跟踪:

java.lang.Object.wait(Native Method)
org.apache.felix.framework.util.ThreadGate.await(ThreadGate.java:79)
org.apache.felix.framework.Felix.waitForStop(Felix.java:1075)
org.apache.karaf.main.Main.awaitShutdown(Main.java:640)
org.apache.karaf.main.Main.main(Main.java:188)

名称:FelixDispatchQueue

State: WAITING on java.util.ArrayList@3276dd18
Total blocked: 353  Total waited: 342

Stack trace: 
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:502)
org.apache.felix.framework.EventDispatcher.run(EventDispatcher.java:1122)
org.apache.felix.framework.EventDispatcher.access[=16=]0(EventDispatcher.java:54)
org.apache.felix.framework.EventDispatcher.run(EventDispatcher.java:102)
java.lang.Thread.run(Thread.java:748)

更新5: 花了很多时间后我终于意识到通过添加下面的包它被卡住了,如果我不添加它们它工作正常

wrappedBundle( maven("org.ops4j.pax.tinybundles", "tinybundles").versionAsInProject() ), //2.1.0
wrappedBundle( maven("biz.aQute.bnd", "bndlib").versionAsInProject() )//2.4.0

此致,

我通过更改以下 jars 版本解决了问题

maven("org.ops4j.pax.tinybundles", "tinybundles") from 2.1.0 to 3.0.0
maven("biz.aQute.bnd", "bndlib")                  from 2.4.0 to 3.5.0