Hi,
I'm trying to create integration tests for the akka project (akka/akka#589) with Pax Exam. However I got stuck. I will post the three options I tried and the errors I get in each. You can try this on your own, pulling this repository: https://github.com/muuki88/akka and run:
> sbt
> test-only akka.osgi.test.LocalActorTest
val osgiCore = "org.osgi" % "org.osgi.core" % "4.2.0" // ApacheV2
val paxExamVersion = "3.0.0.M4"
val felix = "org.apache.felix" % "org.apache.felix.framework" % "4.0.3" % "test" // ApacheV2
val equinox = "org.eclipse.tycho" % "org.eclipse.osgi" % "3.8.1.v20120830-144521" % "test" // EPL
###Dependencies
val paxExamUnit = "org.ops4j.pax.exam" % "pax-exam-junit4" % paxExamVersion % "test"
val paxExamSpi = "org.ops4j.pax.exam" % "pax-exam-spi" % paxExamVersion % "test"
val paxInject = "org.ops4j.pax.exam" % "pax-exam-inject" % paxExamVersion % "test"
val paxLinkAssembly = "org.ops4j.pax.exam" % "pax-exam-link-assembly" % paxExamVersion % "test"
val paxExamForge = "org.ops4j.pax.exam" % "pax-exam-testforge" % paxExamVersion % "test"
val paxExamMvn = "org.ops4j.pax.exam" % "pax-exam-link-mvn" % paxExamVersion % "test"
val paxAether = "org.ops4j.pax.url" % "pax-url-aether" % "1.5.0" % "test"
val paxExamRunner = "org.ops4j.pax.exam" % "pax-exam-container-native" % paxExamVersion % "test"
Config
val osgiTests = Seq(osgiCore, slf4jApi, Test.scalatest, Test.junit, Test.paxExamUnit , Test.paxLinkAssembly, Test.paxExamSpi, Test.paxInject, Test.paxExamRunner, Test.paxNoJcl, Test.paxExamForge, Test.paxExamMvn, Test.paxAether, Test.javaxInject, Test.equinox )
Error
Cause: java.lang.SecurityException: class "org.osgi.framework.hooks.service.EventListenerHook"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:943)
Config
val osgiTests = Seq(osgiCore, slf4jApi, Test.scalatest, Test.junit, Test.paxExamUnit , Test.paxLinkAssembly, Test.paxExamSpi, Test.paxInject, Test.paxExamRunner, Test.paxNoJcl, Test.paxExamForge, Test.paxExamMvn, Test.paxAether, Test.javaxInject, Test.felix )
Error
testActorSystem:akka.osgi.test.LocalActorTest.testActorSystem:Native:FrameworkFactory *** FAILED ***
java.lang.NoSuchMethodError: org.apache.felix.framework.Felix.<init>(Ljava/util/Map;)V
Config
val osgiTests = Seq(osgiCore, slf4jApi, Test.scalatest, Test.junit, Test.paxExamUnit , Test.paxLinkAssembly, Test.paxExamSpi, Test.paxInject, Test.paxExamRunner, /*Test.paxNoJcl,*/ Test.paxExamForge, Test.paxExamMvn, Test.paxAether, Test.javaxInject, Test.equinox )
Error
Cause: java.lang.SecurityException: class "org.osgi.framework.hooks.service.EventListenerHook"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:943)
Config
val osgiTests = Seq(osgiCore, slf4jApi, Test.scalatest, Test.junit, Test.paxExamUnit , Test.paxLinkAssembly, Test.paxExamSpi, Test.paxInject, Test.paxExamRunner, /*Test.paxNoJcl,*/ Test.paxExamForge, Test.paxExamMvn, Test.paxAether, Test.javaxInject, Test.felix )
Error
testActorSystem:akka.osgi.test.LocalActorTest.testActorSystem:Native:FrameworkFactory *** FAILED ***
java.lang.NoSuchMethodError: org.apache.felix.framework.util.Util.getDefaultProperty(Lorg/apache/felix/framework/Logger;Ljava/lang/String;)Ljava/lang/String;
val paxExamRunner = "org.ops4j.pax.exam" % "pax-exam-container-forked" % paxExamVersion % "test"
config
val osgiTests = Seq(osgiCore, slf4jApi, Test.scalatest, Test.junit, Test.paxExamUnit , Test.paxLinkAssembly, Test.paxExamSpi, Test.paxInject, Test.paxExamRunner, Test.paxNoJcl, Test.paxExamForge, Test.paxExamMvn, Test.paxAether, Test.javaxInject, Test.equinox )
Error
testActorSystem:akka.osgi.test.LocalActorTest.testActorSystem:Forked:EquinoxFactory *** FAILED ***
java.net.MalformedURLException: unknown protocol: link
all other configurations produce same error.
val paxExamVersion = "2.5.0"
Error
testActorSystem:akka.osgi.test.LocalActorTest.testActorSystem:PaxRunnerTestContainer{felix} *** FAILED ***
java.lang.NoSuchMethodError: org.apache.felix.framework.ServiceRegistry.<init>(Lorg/apache/felix/framework/Logger;)V
- initializationError *** FAILED ***
java.lang.NoClassDefFoundError: org/ops4j/pax/runner/platform/JavaRunner
at org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainerFactory.create(PaxRunnerTestContainerFactory.java:58)
I've been passing through similar difficulties using scala and pax-exam in gradle.
The error
java.net.MalformedURLException: unknown protocol: link
can be resolved if you put pax-url-link in your classpath