Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix class not found exception without Subversion plugin #24

Merged
merged 2 commits into from
Apr 7, 2021

Conversation

pfeuffer
Copy link
Contributor

@pfeuffer pfeuffer commented Mar 31, 2021

Fixes https://issues.jenkins.io/browse/JENKINS-64985

A ClassNotFoundException was thrown while creating namespace jobs, when the Subversion plugin is not installed. The stack trace looked something like this:

java.lang.ClassNotFoundException: jenkins.scm.impl.subversion.SubversionSCMSource
        at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1387)
        at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1342)
        at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1089)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
Caused: java.lang.NoClassDefFoundError: jenkins/scm/impl/subversion/SubversionSCMSource
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
        at jenkins.util.AntClassLoader.defineClassFromData(AntClassLoader.java:1155)
        at hudson.ClassicPluginStrategy$AntClassLoader2.defineClassFromData(ClassicPluginStrategy.java:715)
        at jenkins.util.AntClassLoader.getClassFromStream(AntClassLoader.java:1326)
        at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1377)
        at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1342)
        at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1089)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at com.cloudogu.scmmanager.scm.ScmManagerNavigator.visitSources(ScmManagerNavigator.java:142)
        at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:542)
        at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:278)
        at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:165)
        at jenkins.branch.OrganizationFolder$OrganizationScan.run(OrganizationFolder.java:1033)
        at hudson.model.ResourceController.execute(ResourceController.java:97)
        at hudson.model.Executor.run(Executor.java:429)

This was due to a reference to a classes only available in the Subversion plugin in ScmManagerSvnSource, and that class in turn was a part of the public API of ScmManagerSvnSourceBuilder due to the generic. But this class is used in ScmManagerNavigator.ScmManagerSvnSourceBuilder and therefore has to be loaded when a job shall be created.

By using SCMSource in the generic instead of the special implementation of the Subversion plugin, we can remove this class from the public API, and therefore this class no longer needs to be loaded unless it is needed.

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes

@sdorra sdorra merged commit 29b2eb5 into master Apr 7, 2021
@sdorra sdorra deleted the bugfix/svn_class_not_found branch April 7, 2021 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants