[JIRA] (PAXRUNNER-443) java.lang.AbstractMethodError/ClassCastException when creating integration test for osgi using felix and PaxRunner Framework

8 views
Skip to first unread message

Aldrin Tingson (JIRA)

unread,
Jun 27, 2014, 3:43:26 AM6/27/14
to ops4j-...@googlegroups.com
Aldrin Tingson created an issue
 
Pax Runner / Bug PAXRUNNER-443
java.lang.AbstractMethodError/ClassCastException when creating integration test for osgi using felix and PaxRunner Framework
Issue Type: Bug Bug
Assignee: Toni Menzel
Created: 27/Jun/14 9:42 AM
Environment: JDK 1.7 64bit, windows 7 64bit
Labels: pax-runner-4.0
Priority: Blocker Blocker
Reporter: Aldrin Tingson

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):

git clone g...@bitbucket.org:aldrintingson/cq-training.git

commands:

mvn clean verify

Fix propsed:
1. Make sure that org.osgi.core has a provided scope

in the parent project it is provided already, plus i tried explicitly specifying it in pom.xml of the bundle(core folder) and still no avail.

2. Create a package first of the project then bundle then add it to bundles during the Configuration phase

did the following steps:

1. uncommented out this line of code in HelloWorldServiceImplIntegrationTest.java
//bundle("file:target/cq-training-core-1.0-SNAPSHOT.jar"),

2. mvn clean package -DskipTests
3. mvn verify

same error

Thanks

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.3-OD-07-013#6327-sha1:66bf7cb)
Atlassian logo

Aldrin Tingson (JIRA)

unread,
Jun 27, 2014, 3:51:27 AM6/27/14
to ops4j-...@googlegroups.com
Aldrin Tingson updated an issue
Change By: Aldrin Tingson
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):

git clone g...@bitbucket.org:aldrintingson/cq-training.git

commands: 

mvn clean verify

Fix propsed:
1. Make sure that org.osgi.core has a provided scope

in the parent project it is provided already, plus i tried explicitly specifying it in pom.xml of the bundle(core folder) and still no avail.

2. Create a package first of the project then bundle then add it to bundles during the Configuration phase

did the following steps:

1 a . uncommented out this line of code in HelloWorldServiceImplIntegrationTest.java
//bundle("file:target/cq-training-core-1.0-SNAPSHOT.jar"),

2 b . mvn clean package -DskipTests
3 c . mvn verify

same error

Thanks

Benson Margulies (JIRA)

unread,
May 15, 2015, 10:23:02 AM5/15/15
to ops4j-...@googlegroups.com
Benson Margulies commented on Bug PAXRUNNER-443
 
Re: java.lang.AbstractMethodError/ClassCastException when creating integration test for osgi using felix and PaxRunner Framework

Here's what I see:

ERROR: Bundle org.ops4j.pax.logging.pax-logging-api [5] Error starting link:classpath:META-INF/links/org.ops4j.pax.logging.api.link (org.osgi.framework.BundleException: Activator start error in bundle org.ops4j.pax.logging.pax-logging-api [5].)
java.lang.ClassCastException: org.ops4j.pax.logging.internal.Activator cannot be cast to org.osgi.framework.BundleActivator
	at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4362)
	at org.apache.felix.framework.Felix.activateBundle(Felix.java:2149)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:2072)
	at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
	at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
	at java.lang.Thread.run(Thread.java:745)

Here's my relevant dependency:

org.osgi:org.osgi.core:jar:5.0.0:provided

Here's my test setup. The bundles in here include nothing from pax, it's all my stuff.

 return options(
                provision(bundles),
                // add in the root when we are using the root case.
                when(useRootFragment()).useOptions(url(String.format("file:%s/rbl-osgi-%s-fragment-bundle.jar", projectBuildDirectory, projectVersion)).noStart()),
                systemPackages(
                        // These are needed for guava.
                        "sun.misc",
                        "javax.annotation",
                        // actually used in RBL; perhaps we need to eliminate?
                        "javax.swing.text",
                        //
                        String.format("org.slf4j;version=\"%s\"", getDependencyVersion("org.slf4j", "slf4j-api"))

                ),
                junitBundles(),
                systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
        );
This message was sent by Atlassian JIRA (v6.5-OD-03-002#65000-sha1:b8f65f8)
Atlassian logo

qing (JIRA)

unread,
Jun 14, 2016, 11:07:02 PM6/14/16
to ops4j-...@googlegroups.com
qing commented on Bug PAXRUNNER-443

http://www.yeezyboost350.uk
http://www.oakleysunglasses-cheapsale.com
http://www.adidasnmd.uk
http://www.authenticjordanscheap.us.com
http://www.michaelkors-outletonlines.us.com
http://www.nmdadidas.us.com
http://www.michaelkors-outletsonline.us.com
http://www.oakleysunglassesoutlet.us
http://www.nikedunks.us.org
http://www.jordanretro.uk
http://www.zoomkb24.com
http://www.jordansforcheap.us.com
http://www.tomsoutletstore.us.com
http://www.michaeljordanshoes.net
http://www.adidasnmd.com.co
http://www.uggoutlet.uk
http://www.kobebasketballshoes.net
http://www.kobesneakers.com
http://www.michaelkorsonline.name
http://www.cheapralphlauren.in.net
http://www.cheapralphlaurenonline.uk
http://www.michaelkors-handbags.net
http://www.jewellerytiffanyand.co
http://www.airjordan.cc
http://www.michael-kors-handbags.com.co
http://www.michaelkorsoutletsfactory.us.com
http://www.11jordanshoes.com
http://www.raybansunglassesoutlet.org
http://www.toms-outletstore.us.com
http://www.kobeshoes.uk
http://www.kobe-shoes.us.com
http://www.huaracheshoes.uk
http://www.tiffanyandcouk.uk
http://www.oakleyoutlet-store.com
http://www.fitflops-saleclearance.us.com
http://www.airhuarache.uk
http://www.huarachesshoes.uk
http://www.michaelkorsoutlets-online.eu.com
http://www.cheaptiffanyandco.in.net
http://www.oakleyvault.com.co
http://www.cheapnfljerseysonlinestore.com
http://www.oakley-sunglasses.co
http://www.michaelkors-outletstore.us.com
http://www.outlettiffanyandco.us.com
http://www.cheapairjordan.us
http://www.chromehearts.com.co
http://www.coach-outlet.in.net
http://www.michaelkorshandbagsclearance.com.co
http://www.cheapauthenticjordans.us.com
http://www.fitflops.cc
http://www.michaelkors-outletfactory.us.com
http://www.cheapbasketballshoes.us.com
http://www.zoomkb24.uk
http://www.michaelkors-outletstores.in.net
http://www.kobebasketballshoes.us.com
http://www.jewelrytiffanyand.co
http://www.oakley-sunglass.in.net
http://www.raybansunglass.us
http://www.rayban-sunglasses.uk
http://www.cheapnfljerseysstorechina.com
http://www.yeezy-shoes.us
http://www.cheap-jordanshoessale.com
http://www.cheap--jordans.us.com
http://www.tiffany.net.co
http://www.oakleyglasses.com.co
http://www.michaeljordanshoes.us.com
http://www.christianlouboutin.in.net
http://www.chinajerseyssaleonline.com
http://www.christian-louboutin-outlet.uk
http://www.yeezyboost.com.co
http://www.chromeheart.us.com
http://www.fitflopssandals.net
http://www.nfljerseys2015.in.net
http://www.truereligiononsale.in.net
http://www.ugg.name
http://www.nfljerseyscheap.in.net
http://www.tiffanyandcooutletonline.us.com
http://www.tiffanyandcojewellery.us.com
http://www.outletonline-michaelkors.us.org
http://www.cheapretro-jordans.com
http://www.mlbjerseyscheap.in.net
http://www.tiffanyand.co.uk
http://www.mlbjerseyswholesale.in.net
http://www.airhuaraches.org.uk
http://www.mlbjerseysauthentic.in.net
http://www.oakleystoreonline.us.org
http://www.cheaprolexwatchesonline.in.net
http://www.tomsoutletstore.name
http://www.michaelkorshandbagsoutlet.eu.com
http://www.fitflopsoutlet.in.net
http://www.yeezyshoes.uk
http://www.fitflops.com.co
http://www.outlettiffanyand.co
http://www.michaelkors-outletonline.co.uk
http://www.cheaptruereligionjeans.us
http://www.nfljerseyswholesale.in.net
http://www.michaelkorsonline.net
http://www.oakleyssunglassescheapsale.com
http://www.huarachesshoes.co.uk
http://www.raybansunglass.uk
http://www.oakleysunglassescheapssale.com
http://www.raybanglasses.in.net
http://www.tiffanyandco-outlet.us.com
http://www.yeezy-boost350.us.com
http://www.minireplicahut.com
http://www.cheap-airjordans.us.com
http://www.cheapairjordan.uk
http://www.chromeheartsonline.us.com
http://www.airjordanretro.uk
http://www.oakleysunglassescheap-sale.com
http://www.michaelkorshandbags.net
http://www.cheapairjordan.in.net
http://www.oakley-sunglassescheapsale.com
http://www.michaelkorsoutletonline.uk
http://www.discount-oakleysunglasses.us.com
http://www.cheaprealjordans.us.com
http://www.chromehearts.in.net
http://www.louis-vuittonhandbags.net
http://www.oakleysunglassescheapsales.com

This message was sent by Atlassian JIRA (v1000.35.2#100001-sha1:985b519)
Atlassian logo

Achim Nierbeck (JIRA)

unread,
Jun 15, 2016, 2:32:07 AM6/15/16
to ops4j-...@googlegroups.com

Grzegorz Grzybek (JIRA)

unread,
Feb 24, 2021, 10:26:00 AM2/24/21
to ops4j-...@googlegroups.com
Get Jira notifications on your phone! Download the Jira Cloud app for Android or iOS
This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100154-sha1:63167d6)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages