0

在 Windows 中运行 Pax-Exam 测试时出现以下错误。并发现了这个问题https://ops4j1.jira.com/browse/PAXEXAM-701

Pax 版本 4.7.0 和 OSGi 版本 org.eclipse.osgi-3.10.2.v20150203-1939

我们怎样才能克服这个问题?

Caused by: org.osgi.framework.BundleException: Error while renaming bundle file to final location: C:\Users\aruna\AppData\Local\Temp\1450091333855-0\org.eclipse.osgi\5\0\bundleFile
	at org.eclipse.osgi.storage.Storage.getContentFile0(Storage.java:767)
	at org.eclipse.osgi.storage.Storage.getContentFile(Storage.java:743)
	at org.eclipse.osgi.storage.Storage.install(Storage.java:508)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.installBundle(BundleContextImpl.java:146)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.installBundle(BundleContextImpl.java:139)
	at org.ops4j.pax.exam.nat.internal.NativeTestContainer.installAndStartBundles(NativeTestContainer.java:308)
	at org.ops4j.pax.exam.nat.internal.NativeTestContainer.start(NativeTestContainer.java:177)
	at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.setUp(EagerSingleStagedReactor.java:86)
	at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.beforeClass(EagerSingleStagedReactor.java:136)
	at org.ops4j.pax.exam.spi.reactors.ReactorManager.beforeClass(ReactorManager.java:448)
	at org.ops4j.pax.exam.testng.listener.PaxExam.runByDriver(PaxExam.java:443)
	at org.ops4j.pax.exam.testng.listener.PaxExam.run(PaxExam.java:308)
	at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:212)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:652)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:845)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1153)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
	at org.testng.TestRunner.privateRun(TestRunner.java:771)
	at org.testng.TestRunner.run(TestRunner.java:621)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
	at org.testng.SuiteRunner.run(SuiteRunner.java:259)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1199)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1124)
	at org.testng.TestNG.run(TestNG.java:1032)
	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:295)
	at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84)
	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:90)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

4

1 回答 1

1

我会做的是以下几点:

  • 在您的 IDE 中设置BundleException构造函数的条件断点。条件是消息参数包含“重命名时出错”
  • 测试应设置为在调试模式下运行,等待调试器附加
  • 测试应该从文件泄漏检测代理开始
  • 开始测试
  • 附加调试器
  • 断点停止后,立即查找您在检漏仪网页的消息中看到的文件名。在那里你会看到创建文件处理程序的线程堆栈,你会发现你的错误。

您需要的 PAX 选项如下所示:

vmOptions("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005", "-javaagent:path/to/file-leak-detector.jar=http=19999")

如果是 PAX 错误,请向他们的团队报告。

于 2015-12-15T22:35:51.933 回答