Pax Exam 2.6.0 + Karaf 2.3.0 - Eclipse中的调试失败 - NotBoundException

时间:2013-01-30 10:16:33

标签: eclipse debugging integration-testing apache-karaf pax-exam

我一直在使用Pax Exam 2.6.0通过 Karaf考试容器在Apache Karaf 2.3.0上运行集成测试。

除了Eclipse的集成测试的本地调试(非远程)之外,一切都按预期工作。 我在这里找到了一个解决方案: http://team.ops4j.org/wiki/display/paxexam/FAQ#FAQ-WhydoestheJavadebuggernotstopatabreakpointIsetinmyPaxExamJUnittest%3F

  

使用Pax Runner容器时,您正在处理两个   Java VM进程,一个运行测试驱动程序,另一个运行   OSGi框架。实际上,您的JUnit类的执行流程   在两个VM之间拆分,并且测试方法的主体是   在远程VM上执行。

     

因此,您需要使用a为生成的VM启用远程调试   @Configuration方法中的vmOption(),例如

     

vmOption( “ - Xrunjdwp:运输= dt_socket,服务器= Y,暂停= Y,地址= 5005”),   systemTimeout(0)

不幸的是,当我尝试在调试模式下从Eclipse启动JUnit测试时,这不起作用我继续为每个运行的@Test - 带注释的方法获取这些错误:

java.rmi.NotBoundException: c59ea59a-f771-47fe-aac8-aa7f5c72b17d
    at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:136)
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:409)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
    at sun.rmi.transport.Transport$1.run(Transport.java:177)
    at sun.rmi.transport.Transport$1.run(Transport.java:174)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:377)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.getRemoteBundleContext(RemoteBundleContextClientImpl.java:263)
    at org.ops4j.pax.exam.rbc.client.intern.RemoteBundleContextClientImpl.waitForState(RemoteBundleContextClientImpl.java:234)
    at org.apache.karaf.tooling.exam.container.internal.KarafTestContainer.waitForState(KarafTestContainer.java:599)
    at org.apache.karaf.tooling.exam.container.internal.KarafTestContainer.start(KarafTestContainer.java:183)
    at org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactor.invoke(AllConfinedStagedReactor.java:67)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner$2.evaluate(JUnit4TestRunner.java:285)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.ops4j.pax.exam.junit.JUnit4TestRunner.run(JUnit4TestRunner.java:94)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Console视图中显示的唯一内容是以下行:

  

在地址:5005

侦听传输dt_socket

我的系统详情如下:

  • 操作系统:Windows 7 64位
  • Java版本:Oracle Java 7 Update 9 64位
  • Pax考试版:2.6.0
  • IDE:Eclipse 4.2

每次都会出现此问题。

作为结论:我的目标是能够在调试模式下直接从Eclipse IDE运行jUnit集成测试。 有人有建议吗?

谢谢!

1 个答案:

答案 0 :(得分:2)

在您的选项[] cfg。

中添加此内容

KarafDistributionOption.debugConfiguration(“8889”,true)