Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SBT and Pax Exam

Hi,

I'm trying to create integration tests for the akka project (https://github.com/akka/akka/pull/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

Versions

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"

Native container

val paxExamRunner   = "org.ops4j.pax.exam"      % "pax-exam-container-native"    % paxExamVersion     % "test"

with equinox and pax-runner-no-jcl

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)

with felix and pax-runner-no-jcl

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

with equinox and no pax-runner-no-jcl

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)

Native container with felix and no pax-runner-no-jcl

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;

Forked container

 val paxExamRunner   = "org.ops4j.pax.exam"      % "pax-exam-container-forked"    % paxExamVersion     % "test"

with equinox and pax-runner-no-jcl

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.

Paxrunner container

val paxExamVersion = "2.5.0"

With no-jcl

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

Without no-jcl

- initializationError *** FAILED ***
java.lang.NoClassDefFoundError: org/ops4j/pax/runner/platform/JavaRunner
at org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainerFactory.create(PaxRunnerTestContainerFactory.java:58)
@rafael-brandao

This comment has been minimized.

Copy link

@rafael-brandao rafael-brandao commented Dec 20, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment