我正在尝试为我的包创建集成测试。基本上我想模仿我在正常的web应用程序项目的设置(其中测试在src/test文件夹)
我几乎已经完成了,除了当bundle试图激活
时我有一个异常本地容器异常
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)
叉形容器异常
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
我试着提交给他们的官方JIRA董事会,但我没有这样做的许可:
https://ops4j1.jira.com/browse/PAXEXAM/fixforversion/12880/?selectedTab=com.atlassian.jira.jira-projects-plugin version-issues-panel
有专家能帮我解决这个问题吗?我已经山穷水尽了
示例项目(如果项目文件不工作就告诉我):
http://www.mediafire.com/download/qnh2gzgygys9982/cq-training.zip命令:MVN clean verify
谢谢
看起来您的类路径上有冲突的OSGi Core API版本。在运行时,您的OSGi框架(Felix或Equinox)应该是类路径上唯一的Core API。
如果你有其他版本,如org.osgi:org.osgi.core
作为一个(传递的)依赖,确保给它provided
作用域或排除依赖
想关注这个问题的人,请访问他们的官方Google群组页面:
https://groups.google.com/forum/!主题/ops4j g43cPidOvng
发布JIRA Issue:
https://ops4j1.jira.com/browse/paxrunner - 443 ?filter= - 2