java.lang.NoClassDefFoundError: Could not initialize class de.agilecoders.wicket.webjars.util.WebjarsVersion$Holder

Jenkins JIRA | Sven Ackermann | 6 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I'm using [wicket-webjars|https://github.com/l0rdn1kk0n/wicket-webjars] in a maven multi-module project and for some reason all tests in a maven job in Jenkins fail from time to time (hard to reproduce) with a weird NoClassDefFoundError: {code:java} java.lang.NoClassDefFoundError: Could not initialize class de.agilecoders.wicket.webjars.util.WebjarsVersion$Holder at de.agilecoders.wicket.webjars.util.WebjarsVersion.useRecent(WebjarsVersion.java:46) at de.agilecoders.wicket.webjars.request.resource.WebjarsCssResourceReference.<init>(WebjarsCssResourceReference.java:27) at mycompany.MyBasePage.renderHead(MyBasePage.java:140) at org.apache.wicket.Component.renderHead(Component.java:4489) at org.apache.wicket.Component.internalRenderHead(Component.java:2715) at org.apache.wicket.markup.renderStrategy.AbstractHeaderRenderStrategy.renderRootComponent(AbstractHeaderRenderStrategy.java:119) at org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy.renderHeader(ChildFirstHeaderRenderStrategy.java:60) at org.apache.wicket.markup.html.internal.HtmlHeaderContainer.onComponentTagBody(HtmlHeaderContainer.java:171) at org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:70) at org.apache.wicket.Component.internalRenderComponent(Component.java:2565) at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1698) at org.apache.wicket.Component.internalRender(Component.java:2380) at org.apache.wicket.Component.render(Component.java:2308) at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1524) at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1759) at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1734) at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1657) at org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:70) at org.apache.wicket.Component.internalRenderComponent(Component.java:2565) at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1698) at org.apache.wicket.Component.internalRender(Component.java:2380) at org.apache.wicket.Component.render(Component.java:2308) at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1524) at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1759) at org.apache.wicket.Page.onRender(Page.java:879) at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:141) at org.apache.wicket.Component.internalRender(Component.java:2380) at org.apache.wicket.Component.render(Component.java:2308) at org.apache.wicket.Page.renderPage(Page.java:1018) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:124) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:236) at org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider$1.respond(BaseWicketTester.java:2747) at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:718) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:657) at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:887) at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:904) at mycompany.MyTest.testWithWebjarsInvolved(MyTest.java:95) {code} This does not happen on every build. It can even happen on one build and if I rebuild it immediately without any changes, then the build is fine. Also, the problem occurs only in Jenkins, it never happened on a local Maven build. Note that the class that cannot be loaded (WebjarsVersion$Holder) is in the same JAR as the class that wants to load it (WebjarsVersion) and I don't see any dependencies that could be missing (it's only "slf4j" and "wicket" and if they would be missing, the build would fail earlier). I already reported an [issue at wicket-webjars|https://github.com/l0rdn1kk0n/wicket-webjars/issues/48] and they just told me they have the same weird problem on their Cloudbees server and suspect it could be a problem with Jenkins class loading. So I'm hoping you might have a clue what's wrong here. Some more versions: Wicket 7.2.0 wicket-webjars 0.5.3 Junit 4.12 Maven build options: -Xmx1024m -XX:MaxPermSize=512m -T 4 clean deploy The problem happened since we started using webjars. At that time we had much older versions of Jenkins, Maven & Wicket, so I think it doesn't really depend on a specific version. Thanks in advance, Sven

    Jenkins JIRA | 6 months ago | Sven Ackermann
    java.lang.NoClassDefFoundError: Could not initialize class de.agilecoders.wicket.webjars.util.WebjarsVersion$Holder

    Root Cause Analysis

    1. java.lang.NoClassDefFoundError

      Could not initialize class de.agilecoders.wicket.webjars.util.WebjarsVersion$Holder

      at de.agilecoders.wicket.webjars.util.WebjarsVersion.useRecent()
    2. library
      WebjarsCssResourceReference.<init>
      1. de.agilecoders.wicket.webjars.util.WebjarsVersion.useRecent(WebjarsVersion.java:46)
      2. de.agilecoders.wicket.webjars.request.resource.WebjarsCssResourceReference.<init>(WebjarsCssResourceReference.java:27)
      2 frames
    3. mycompany
      MyBasePage.renderHead
      1. mycompany.MyBasePage.renderHead(MyBasePage.java:140)
      1 frame
    4. Wicket Core
      RequestCycle$HandlerExecutor.respond
      1. org.apache.wicket.Component.renderHead(Component.java:4489)
      2. org.apache.wicket.Component.internalRenderHead(Component.java:2715)
      3. org.apache.wicket.markup.renderStrategy.AbstractHeaderRenderStrategy.renderRootComponent(AbstractHeaderRenderStrategy.java:119)
      4. org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy.renderHeader(ChildFirstHeaderRenderStrategy.java:60)
      5. org.apache.wicket.markup.html.internal.HtmlHeaderContainer.onComponentTagBody(HtmlHeaderContainer.java:171)
      6. org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:70)
      7. org.apache.wicket.Component.internalRenderComponent(Component.java:2565)
      8. org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1698)
      9. org.apache.wicket.Component.internalRender(Component.java:2380)
      10. org.apache.wicket.Component.render(Component.java:2308)
      11. org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1524)
      12. org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1759)
      13. org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1734)
      14. org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1657)
      15. org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:70)
      16. org.apache.wicket.Component.internalRenderComponent(Component.java:2565)
      17. org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1698)
      18. org.apache.wicket.Component.internalRender(Component.java:2380)
      19. org.apache.wicket.Component.render(Component.java:2308)
      20. org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1524)
      21. org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1759)
      22. org.apache.wicket.Page.onRender(Page.java:879)
      23. org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:141)
      24. org.apache.wicket.Component.internalRender(Component.java:2380)
      25. org.apache.wicket.Component.render(Component.java:2308)
      26. org.apache.wicket.Page.renderPage(Page.java:1018)
      27. org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:124)
      28. org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:236)
      29. org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider$1.respond(BaseWicketTester.java:2747)
      30. org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
      31. org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895)
      31 frames
    5. Wicket Request
      RequestHandlerStack.execute
      1. org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
      1 frame
    6. Wicket Core
      BaseWicketTester.startPage
      1. org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
      2. org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
      3. org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
      4. org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:718)
      5. org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:657)
      6. org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:887)
      7. org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:904)
      7 frames
    7. mycompany
      MyTest.testWithWebjarsInvolved
      1. mycompany.MyTest.testWithWebjarsInvolved(MyTest.java:95)
      1 frame