>>>>> Steinar Bang <s...@dod.no>: >>>>> Steinar Bang <s...@dod.no>: >> This worked fine in getting karaf to start and the service to be >> produced, but actually using mockito mocks failed: >> java.lang.LinkageError: loader constraint violation in interface itable >> initialization: when resolving method >> "$javax.servlet.http.HttpServletRequest$$EnhancerByMockitoWithCGLIB$$22025fbe.newInstance([Ljava/lang/Class;[Ljava/lang/Object;[Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object;" >> the class loader (instance of >> org/mockito/internal/creation/util/SearchingClassLoader) of the current >> class, >> $javax/servlet/http/HttpServletRequest$$EnhancerByMockitoWithCGLIB$$22025fbe, >> and the class loader (instance of >> org/apache/felix/framework/BundleWiringImpl$BundleClassLoader) for interface >> org/mockito/cglib/proxy/Factory have different Class objects for the type >> [Lorg/mockito/cglib/proxy/Callback; used in the signature > [snip!]
>> This is the code that fails: >> https://gist.github.com/steinarb/5534a87dd42827fad7a461732d6d5684#file-fildeleintegrationtest-java-L64 >> I don't have any idea how to fix this, or even if it's fixable...? > I tried setting > frameworkProperty("felix.bootdelegation.implicit").value("false"), > like what I found here: > > https://github.com/ops4j/org.ops4j.pax.exam2/blob/master/itest/osgi/src/it/regression-multi/src/test/java/org/ops4j/pax/exam/regression/multi/wrap/MockitoTest.java#L100 > But I still got the same error: Now I've tried the following steps, none of which have fixed the problem: 1. Created a separate maven project to create the mockito feature file, and changed the maven dependencies of the pax-exam test project: - changed the scope of mockito-core from compile to test - removed the dependencies of objenesis and hamcrest from the pax-exam test projects This did not fix the error 2. Switched the mockito-core maven test scope dependency of the pax-exam test project to a mockito-all test scope dependency This didn't fix the error either (I didn't really expect it to fix the error, but since this is what the integration test does[1], it was worth a shot in the dark) 3. Replaced my karaf feature use in the pax-exam config with referencing the maven bundles of mockito, objenesis and hamcrest directly, like the integration test does[2] This didn't fix the problem either (I didn't really expect it to, since the karaf feature pulling in the same bundles, got the error, but it was worth trying to do the exact same thing as the integration test) Is there something else I can try? References: [1] <https://github.com/ops4j/org.ops4j.pax.exam2/blob/master/itest/osgi/src/it/regression-multi/pom.xml#L140> [2] <https://github.com/ops4j/org.ops4j.pax.exam2/blob/master/itest/osgi/src/it/regression-multi/src/test/java/org/ops4j/pax/exam/regression/multi/wrap/MockitoTest.java#L117> -- -- ------------------ OPS4J - http://www.ops4j.org - ops4j@googlegroups.com --- You received this message because you are subscribed to the Google Groups "OPS4J" group. To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.