Search code examples
mavenosgiapache-felixequinoxpax-exam

Pax Exam tests fail with OSGi R6 frameworks (Equinox 3.10.x, Felix 4.6.x)


I migrated my build to OSGi R6, using Equinox 3.10.1.v20140909-1633 and Felix 4.6.1. Unfortunately, the Pax Exam tests are failing in both frameworks. I am using Pax Exam 4.4.0.

Tests executed on Equinox 3.10.1.v20140909-1633:

org.osgi.framework.BundleException: Error while renaming bundle file to final location: C:\Temp\1428560128319-0\org.eclipse.osgi\1\0\bundleFile
        at org.eclipse.osgi.storage.Storage.getContentFile0(Storage.java:765)
        at org.eclipse.osgi.storage.Storage.getContentFile(Storage.java:741)
        at org.eclipse.osgi.storage.Storage.install(Storage.java:506)
        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.swissbox.framework.RemoteFrameworkImpl.installBundle(RemoteFrameworkImpl.java:120)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
        at sun.rmi.transport.Transport$1.run(Transport.java:178)
        at sun.rmi.transport.Transport$1.run(Transport.java:175)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:174)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:557)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:812)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:671)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
        at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:276)
        at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:253)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:162)
        at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
        at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
        at com.sun.proxy.$Proxy8.installBundle(Unknown Source)
        at org.ops4j.pax.exam.forked.ForkedTestContainer.installAndStartBundles(ForkedTestContainer.java:282)
        at org.ops4j.pax.exam.forked.ForkedTestContainer.start(ForkedTestContainer.java:165)
        at org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactor.invoke(AllConfinedStagedReactor.java:79)
        at org.ops4j.pax.exam.junit.impl.ProbeRunner$2.evaluate(ProbeRunner.java:267)
        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.impl.ProbeRunner.run(ProbeRunner.java:98)
        at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
        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)

Tests executed on Felix 4.6.1:

ERROR: Error reloading cached bundle, removing it: C:\TEMP\1428560514273-0\bundle1 (java.io.FileNotFoundException: C:\TEMP\1428560514273-0\bundle1\bundle.location (Das System kann
die angegebene Datei nicht finden))
java.io.FileNotFoundException: C:\TEMP\1428560514273-0\bundle1\bundle.location (Das System kann die angegebene Datei nicht finden)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at org.apache.felix.framework.util.SecureAction.getFileInputStream(SecureAction.java:453)
        at org.apache.felix.framework.cache.BundleArchive.readLocation(BundleArchive.java:1107)
        at org.apache.felix.framework.cache.BundleArchive.readBundleInfo(BundleArchive.java:973)
        at org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:182)
        at org.apache.felix.framework.cache.BundleCache.getArchives(BundleCache.java:247)
        at org.apache.felix.framework.Felix.init(Felix.java:754)
        at org.apache.felix.framework.Felix.init(Felix.java:624)
        at org.ops4j.pax.swissbox.framework.RemoteFrameworkImpl.init(RemoteFrameworkImpl.java:96)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
        at sun.rmi.transport.Transport$1.run(Transport.java:178)
        at sun.rmi.transport.Transport$1.run(Transport.java:175)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:174)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:557)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:812)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:671)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

I reverted my changes and executed the Pax Exam test with OSGi R5, using Equinox 3.9.1.v20130814-1242 and Felix 4.4.1. Everything is working as excpected.

Does Pax Exam have a problem with OSGi R6 framework implementations?

UPDATE

I am using @ExamReactorStrategy(PerMethod.class) and all runs fail except the first. The first run always succeeds. I have tried the options keepCaches and cleanCaches, but it does not help. Why does the problem only occur in R6 framework implementations? Is there a fix or a workaround?


Solution

  • Problem tracked as PAXEXAM-701. Will be fixed in Pax Exam 4.5.0.