0

I am trying to create integration test for my bundle. basically I want to mimic the setup I have in normal web app project(wherein the test are in src/test folder)

I am almost there except that I have exception when the bundle tries to activate

native container exception

Running com.grundfos.wcm.impl.HelloWorldServiceImplIntegrationTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.196 sec <<< FAILURE! - in    com.grundfos.wcm.impl.HelloWorldServiceImplIntegrationTest
whenSuppliedNullNameThenThrowException(com.grundfos.wcm.impl.HelloWorldServiceImplIntegrationTest)       Time elapsed: 0.792 sec  <<< ERROR!
java.lang.AbstractMethodError: org.apache.felix.framework.BundleImpl.adapt(Ljava/lang/Class;)Ljava/lang/Object; at org.ops4j.pax.exam.nat.internal.NativeTestContainer.installAndStartBundles(NativeTestContainer.java:311)
at org.ops4j.pax.exam.nat.internal.NativeTestContainer.start(NativeTestContainer.java:177)
at org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactor.invoke(AllConfinedStagedReactor.java:79)
at org.ops4j.pax.exam.junit.impl.ProbeRunner$2.evaluate(ProbeRunner.java:264)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
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:264)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

forked container exception

java.lang.ClassCastException: org.ops4j.pax.exam.inject.internal.Activator cannot be cast to org.osgi.framework.BundleActivator
    at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3814)
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:1899)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1822)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1192)
    at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:266)
    at java.lang.Thread.run(Thread.java:745)
java.lang.ClassCastException: org.ops4j.pax.exam.raw.extender.intern.Activator cannot be cast to org.osgi.framework.BundleActivator

I tried submitting to their official JIRA board but I have no permission to do so:

https://ops4j1.jira.com/browse/PAXEXAM/fixforversion/12880/?selectedTab=com.atlassian.jira.jira-projects-plugin:version-issues-panel

Can someone expert help me with my problem? I am at the end of my ropes already :(

Sample Project(If the project file does not work just tell me):

http://www.mediafire.com/download/qnh2gzgygys9982/cq-training.zip

command: mvn clean verify

Thanks

silencer07
  • 131
  • 1
  • 7
  • Regarding the JIRA permissions, it seems Atlassian changed the defaults on our hosted instance. I've fixed them, so you should now be able to create an issue, once you've signed up for a JIRA account. Please try again and contact `ops4j@googlegroups.com` if you're still having problems. – Harald Wellmann Jun 20 '14 at 14:52
  • i still have no permission to post. but i shall mail them. thank you sir – silencer07 Jun 22 '14 at 04:58
  • I can't send them email, looks like i am not allowed to do so. halp :( – silencer07 Jun 23 '14 at 08:39

2 Answers2

0

Looks like you're having conflicting versions of the OSGi Core API on your class path. At runtime, your OSGi framework (Felix or Equinox) should be the only Core API on the classpath.

If you have some other version like org.osgi:org.osgi.core as a (transitive) dependency, make sure to give it provided scope or to exclude the dependency.

Harald Wellmann
  • 12,615
  • 4
  • 41
  • 63
  • In the parent project, the scope is already provided. tried specifying that too on the bundle project(core) that osgi.core is in provided scope. same problem – silencer07 Jun 22 '14 at 04:53
0

For those who wants to follow the Issue, pls go to their official Google Group Page:

https://groups.google.com/forum/#!topic/ops4j/g43cPidOvng

Posted JIRA Issue:

https://ops4j1.jira.com/browse/PAXRUNNER-443?filter=-2

silencer07
  • 131
  • 1
  • 7