[Odlparent-dev] centinel/features broken with java.lang.NoClassDefFoundError: Could not initialize class org.opendaylight.odlparent.featuretest.PerRepoTestRunner

Michael Vorburger vorburger at redhat.com
Wed Jan 11 22:15:54 UTC 2017


Just to wrap this up (more of an FYI) :

On Thu, Dec 22, 2016 at 2:06 PM, Alexis de Talhouët <adetalhouet at inocybe.com
> wrote:

> On Dec 21, 2016, at 8:56 PM, Michael Vorburger <vorburger at redhat.com>
> wrote:
>
> Alexis, [+who else could possibly help with this?]
>
> On Wed, Dec 14, 2016 at 6:51 PM, Alexis de Talhouët <
> adetalhouet at inocybe.com> wrote:
>
>> On Dec 14, 2016, at 12:47 PM, Michael Vorburger <vorburger at redhat.com>
>> wrote:
>>
>> Hello Centinel project,
>>
>> I'm attempting to locally run autorelease (in order to verify
>> https://git.opendaylight.org/gerrit/#/c/48901/; but this email is while
>> using master, ignore that), and am finding the SingleFeatureTest fails for
>> me for autorelease/centinel/features with the error below, even though it
>> just worked just fine for many other features - do you know anything about
>> this?
>>
>>
>> Oh yes we do :) See https://lists.opendaylight
>> .org/pipermail/release/2016-December/008927.html for reference.
>> The fix was just merged: https://git.opendaylight.org/gerrit/#/c/49356/
>>
>
> I've hit a very similar error again; now integration/distribution/features-test
> is failing with the "java.lang.NoClassDefFoundError: Could not initialize
> class org.opendaylight.odlparent.featuretest.SingleFeatureTest", if and
> only if it's running with the new SingleFeatureTest incl. TestBundleDiag
> from https://git.opendaylight.org/gerrit/#/c/48901/, as also seen on the
> latest Jenkins jobs build failures of that Gerrit, with this:
>
> Running org.opendaylight.odlparent.featuretest.SingleFeatureTest
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.082 sec
> <<< FAILURE! - in org.opendaylight.odlparent.featuretest.SingleFeatureTest
> initializationError(org.opendaylight.odlparent.featuretest.SingleFeatureTest)
> Time elapsed: 0.056 sec  <<< ERROR!
> java.lang.NoClassDefFoundError: Could not initialize class
> org.opendaylight.odlparent.featuretest.SingleFeatureTest
>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>     at sun.reflect.NativeConstructorAccessorImpl.newInstance(Native
> ConstructorAccessorImpl.java:62)
>     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De
> legatingConstructorAccessorImpl.java:45)
>     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>     at java.lang.Class.newInstance(Class.java:442)
>     at org.ops4j.pax.exam.junit.impl.ProbeRunner.<init>(ProbeRunner
> .java:76)
>     at org.ops4j.pax.exam.junit.PaxExam.createDelegate(PaxExam.java:82)
>     at org.ops4j.pax.exam.junit.PaxExam.<init>(PaxExam.java:73)
>     at org.opendaylight.odlparent.featuretest.PerFeatureRunner.<ini
> t>(PerFeatureRunner.java:58)
>     at org.opendaylight.odlparent.featuretest.PerRepoTestRunner.run
> nersFromFeatures(PerRepoTestRunner.java:119)
>     at org.opendaylight.odlparent.featuretest.PerRepoTestRunner.run
> nersFromRepoUrl(PerRepoTestRunner.java:98)
>     at org.opendaylight.odlparent.featuretest.PerRepoTestRunner.run
> nersFromRepoUrl(PerRepoTestRunner.java:90)
>     at org.opendaylight.odlparent.featuretest.PerRepoTestRunner.<
> init>(PerRepoTestRunner.java:58)
>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>     at sun.reflect.NativeConstructorAccessorImpl.newInstance(Native
> ConstructorAccessorImpl.java:62)
>     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De
> legatingConstructorAccessorImpl.java:45)
>     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>     at org.junit.internal.builders.AnnotatedBuilder.buildRunner(Ann
> otatedBuilder.java:29)
>     at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(
> AnnotatedBuilder.java:21)
>     at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(Run
> nerBuilder.java:59)
>     at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.
> runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
>     at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(Run
> nerBuilder.java:59)
>     at org.junit.internal.requests.ClassRequest.getRunner(ClassRequ
> est.java:26)
>     at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUni
> t4Provider.java:283)
>     at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithR
> erun(JUnit4Provider.java:173)
>     at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestS
> et(JUnit4Provider.java:153)
>     at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit
> 4Provider.java:128)
>     at org.apache.maven.surefire.booter.ForkedBooter.invokeProvider
> InSameClassLoader(ForkedBooter.java:203)
>     at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInPro
> cess(ForkedBooter.java:155)
>     at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBoo
> ter.java:103)
>
> Note that it isn't exactly the same as the original one shown below; the
> original one is failing to even instantiate the PerRepoTestRunner, while
> this one gets past that, but then fails (with the same
> NoClassDefFoundError) when PerRepoTestRunner -> PerFeatureRunner -> PaxExam
> tries to instantiate the SingleFeatureTest. No idea what's causing this
> subtle difference, for the same problem to happen just a little later. As
> far as I understand, and can see from the code, we're still in the base
> class loader (surefire), not yet in any OSGi context - do you agree?
>
> The removal of the centinel-features dependency in
> integration/distribution/features-index/pom.xml does make the problem
> shown above go away. I don't suppose just removing centinel from
> autorelease is an acceptable option to resolve above? ;-)
>
> So inspired by c/49356 <https://git.opendaylight.org/gerrit/#/c/49356/>,
> I've found that you may have missed one similar occurrence in sentinel, and
> tried https://git.opendaylight.org/gerrit/#/c/49722/ - but that did not
> solve it.. :-(
>
> You said it didn't solve it, although the SFT ran and succeeded, ending up
> with Jenkins +1 on the patch. So not sure to see why it's not a success?
>

what was failing is the SFT with
https://git.opendaylight.org/gerrit/#/c/48901/ in
integration/distribution/features-test.

https://git.opendaylight.org/gerrit/#/c/50293/ magically fixed it.


So then I've done attempted similar clean-ups in a number of other places,
> found by doing a "dependency:tree" in integration/distribution/features-test,
> to remove  jcl-over-slf4j or slf4j-log4j12 and/or log4j-over-slf4j, which
> perhaps you'd like to +1 so that they can go in if you agree:
>
> * sentinel: https://git.opendaylight.org/gerrit/#/c/49722/
> * tsdr: https://git.opendaylight.org/gerrit/#/c/49723/
> * snmp4sdn: https://git.opendaylight.org/gerrit/#/c/49724/
> * integration/distribution: https://git.opendaylight.org/gerrit/#/c/49725/
> * odlparent: https://git.opendaylight.org/gerrit/#/c/49726/
>
> However, unfortunately none of these help - even with all of this, I'm
> still getting the NoClassDefFoundError from SFT in
> integration/distribution/features-test when running under c/48901! :-(
>
>
> The mvn dependency:tree is also what I've used to find artifacts pulling
> transitively org.slf4j dependencies. So I trust your patches above are
> valid if you have followed the same process.
> Regarding this not solving the current issue, well Cardinal faced recently
> a breakage of SFT for reason I couldn't root cause as well. It seems they
> have solved it with the two latest patches merged in master. (I don't
> really get the fix anyway).
>
>
> BTW: Do you / anybody have a full understanding of what's really going on
> here? I've spent hours banging my head against the desk to try to fully
> grasp it, but still find it a bit nebulous...  for starters, it would be
> lovely to be able to get a clearer error message including the real full
> root cause, but even having tried various catch etc. I wasn't able to. The
> NativeConstructorAccessorImpl.newInstance0 is, well, "native", so..
> tough.
>
>
> My understanding is the following:
> I believe the culprit is this patch https://git.
> opendaylight.org/gerrit/#/c/48934/ - Bug 6523: Use
> opendaylight-karaf-empty for SingleFeatureTest
> It has changed a the classpath configuration, by adding, among others,
> org/ops4j/pax/logging/pax-logging-api dependency, which is clashing with
> the org/slf4j/slf4j-api/ one. I believe this might not be the only think
> that patch brought in. But all our misery is since that patch was merged.
> Even tough that patch is fixing a BUG, I think it's been way to
> disruptive, and I would propose a revert until better solution is found. My
> 2 cents.
>
>
> It's clearly something to do with the initialization of the Logger,
> agreed?
>
>
> Yes, I agree. Again this is because of pax logger vs slf4j logger.
>
> I've tried to make it non-static, but that changes nothing. Non static
> final constant fields are called as-if in the constructor, so it's happened
> there during construction (apparently not important if during class loading
> or creation of first instance, same result).
>
> It's not actually really something happening during the execution of
> LoggerFactory.getLogger(), but really a class loading issue happening
> before it even gets into that (thus I've failed to catch and log something
> clearer) - NoClassDefFoundError extends LinkageError. And from what I
> understand of this stuff, it's also not to be confused with the
> ClassNotFoundException which extends ReflectiveOperationException; here the
> JVM IS finding the SingleFeatureTest class in the JAR, but it's falling
> over while linking it when loading that .class?
>
> So must be some slf4j JAR(s!) version mismatch, as warned against on
> http://www.slf4j.org/codes.html#version_mismatch? But then why am I
> *STILL* seeing it in SFT (with c/48901) after excluding *ALL* slfj4 related
> bindings?
>
> I initially also suspected that perhaps we have different slf4j API
> versions on the classpath of SFT, and indeed we do, but even manually
> cleaning this out (i.e. just delete in the JAR, for a quick first hack) did
> not make a difference, so that's not it either:
>
> jar:file:/home/vorburger/.m2/repository/org/glassfish/extras
> /bean-validator/4.0.0.Alpha3/bean-validator-4.0.0.Alpha3.jar
> !/org/slf4j/Logger.class
> jar:file:/home/vorburger/.m2/repository/org/ops4j/pax/loggin
> g/pax-logging-api/1.8.4/pax-logging-api-1.8.4.jar!/org/slf4j/Logger.class
> jar:file:/home/vorburger/.m2/repository/org/slf4j/slf4j-api/
> 1.7.21/slf4j-api-1.7.21.jar!/org/slf4j/Logger.class
>
> Tx,
> M.
>
> PS: I've added a note on https://wiki.opendaylight.org/
> view/CrossProject:Integration_Group:SingleFeature_Test#It_fa
> ils_to_start_the_tests as well, to be able to find this again in the
> future.
>
> --
> Michael Vorburger <vorburger at redhat.com> | IRC: vorburger @freenode | ~ =
> http://vorburger.ch
>
>
>> [INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @
>> centinel-features ---
>> [INFO] Surefire report directory: /home/vorburger/dev/ODL/git/au
>> torelease/centinel/features/target/surefire-reports
>>
>> -------------------------------------------------------
>>  T E S T S
>> -------------------------------------------------------
>> Running org.opendaylight.odlparent.featuretest.SingleFeatureTest
>> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.009 sec
>> <<< FAILURE! - in org.opendaylight.odlparent.fea
>> turetest.SingleFeatureTest
>> initializationError(org.opendaylight.odlparent.featuretest.SingleFeatureTest)
>> Time elapsed: 0.007 sec  <<< ERROR!
>> java.lang.NoClassDefFoundError: Could not initialize class
>> org.opendaylight.odlparent.featuretest.PerRepoTestRunner
>>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> Method)
>>     at sun.reflect.NativeConstructorAccessorImpl.newInstance(Native
>> ConstructorAccessorImpl.java:62)
>>     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De
>> legatingConstructorAccessorImpl.java:45)
>>     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>>     at org.junit.internal.builders.An
>> <http://org.junit.internal.builders.an/>notatedBuilder.buildRunner(Ann
>> otatedBuilder.java:29)
>>     at org.junit.internal.builders.An
>> <http://org.junit.internal.builders.an/>notatedBuilder.runnerForClass(
>> AnnotatedBuilder.java:21)
>>     at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(Run
>> nerBuilder.java:59)
>>     at org.junit.internal.builders.Al
>> <http://org.junit.internal.builders.al/>lDefaultPossibilitiesBuilder.r
>> unnerForClass(AllDefaultPossibilitiesBuilder.java:26)
>>     at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(Run
>> nerBuilder.java:59)
>>     at org.junit.internal.requests.Cl
>> <http://org.junit.internal.requests.cl/>assRequest.getRunner(ClassRequ
>> est.java:26)
>>     at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUni
>> t4Provider.java:283)
>>     at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithR
>> erun(JUnit4Provider.java:173)
>>     at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestS
>> et(JUnit4Provider.java:153)
>>     at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit
>> 4Provider.java:128)
>>     at org.apache.maven.surefire.booter.ForkedBooter.invokeProvider
>> InSameClassLoader(ForkedBooter.java:203)
>>     at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInPro
>> cess(ForkedBooter.java:155)
>>     at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBoo
>> ter.java:103)
>>
>> --
>> Michael Vorburger <vorburger at redhat.com> | IRC: vorburger @freenode | ~
>> = http://vorburger.ch
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opendaylight.org/pipermail/odlparent-dev/attachments/20170111/6a63120f/attachment-0001.html>


More information about the Odlparent-dev mailing list