Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-65473

maven-metadata-plugin shows ClassCastException

      We use the maven-metadata-plugin for a lot of deployment jobs.
      Since we've upgraded Jenkins from 2.249.2 (LTS) to 2.277.1 (LTS) the plugin is not longer working.
      The problem still exists on 2.277.2 (LTS) and is reproducable on latest Jenkins core, too.

      The select box on each job's parameter page shows the same error message (see screenshot)

      Looking at the jenkins.log following stack trace is shown

      2021-04-26 13:06:43.841+0000 [id=2293790]       WARNING e.m.j.p.m.MavenMetadataParameterDefinition#getArtifactMetadata: Could not parse maven-metadata.xml
      
      javax.xml.bind.JAXBException: ClassCastException: attempting to cast jar:file:/var/lib/jenkins/plugins/jaxb/WEB-INF/lib/jaxb-api-2.3.0.jar!/javax/xml/bind/JAXBContext.class to jar:file:/var/lib/jenkins/plugins/jackson2-api/WEB-INF/lib/jakarta.xml.bind-api-2.3.2.jar!/jav
      ax/xml/bind/JAXBContext.class.  Please make sure that you are specifying the proper ClassLoader.     
              at javax.xml.bind.ContextFinder.handleClassCastException(ContextFinder.java:111)
      
              at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:254)
      
              at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:240)
      
              at javax.xml.bind.ContextFinder.find(ContextFinder.java:363)
      
              at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:691)
      
              at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:632)
      
              at eu.markov.jenkins.plugin.mvnmeta.MavenMetadataParameterDefinition.getArtifactMetadata(MavenMetadataParameterDefinition.java:258)
      
              at eu.markov.jenkins.plugin.mvnmeta.MavenMetadataParameterDefinition.getVersions(MavenMetadataParameterDefinition.java:208)
      
              at jdk.internal.reflect.GeneratedMethodAccessor17819.invoke(Unknown Source)
      
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      
              at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      
              at org.apache.commons.jexl.util.PropertyExecutor.execute(PropertyExecutor.java:125)
      
              at org.apache.commons.jexl.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:314)
      
              at org.apache.commons.jexl.parser.ASTArrayAccess.evaluateExpr(ASTArrayAccess.java:185)
      
              at org.apache.commons.jexl.parser.ASTIdentifier.execute(ASTIdentifier.java:75)
      
              at org.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:83)
      
              at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:57)
      
              at org.apache.commons.jexl.parser.ASTReferenceExpression.value(ASTReferenceExpression.java:51)
      
              at org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:80)
      
              at hudson.ExpressionFactory2$JexlExpression.evaluate(ExpressionFactory2.java:74)
      
              at org.apache.commons.jelly.expression.ExpressionSupport.evaluateRecurse(ExpressionSupport.java:61)
      
              at org.apache.commons.jelly.expression.ExpressionSupport.evaluateAsIterator(ExpressionSupport.java:94)
      
              at org.apache.commons.jelly.tags.core.ForEachTag.doTag(ForEachTag.java:89)
      
              at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
      
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:100)
      
              at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
      
              at org.apache.commons.jelly.tags.core.OtherwiseTag.doTag(OtherwiseTag.java:41)
      
              at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
      
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      
              at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
      
              at org.apache.commons.jelly.tags.core.ChooseTag.doTag(ChooseTag.java:38)
      
              at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
      
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:100)
      
              at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:99)
      
              at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
      
              at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
      
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:100)
      
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      
              at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
      
              at org.apache.commons.jelly.tags.core.WhenTag.doTag(WhenTag.java:46)
      
              at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
      
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      
              at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
      
              at org.apache.commons.jelly.tags.core.ChooseTag.doTag(ChooseTag.java:38)
      
              at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
      
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:100)
      
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      
              at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
      
              at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:120)
      
              at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
      
              at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:95)
      
              at org.kohsuke.stapler.jelly.IncludeTag.doTag(IncludeTag.java:147)
      
              at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
      
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:100)
      
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      
              at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
      
              at org.apache.commons.jelly.tags.core.ForEachTag.doTag(ForEachTag.java:150)
      
              at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
      
              at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
      
              at org.kohsuke.stapler.jelly.CallTagLibScript$1.run(CallTagLibScript.java:99)
      
              at org.apache.commons.jelly.tags.define.InvokeBodyTag.doTag(InvokeBodyTag.java:91)
      
              at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
      
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:100)
      
              at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:100)
      

          [JENKINS-65473] maven-metadata-plugin shows ClassCastException

                  at eu.markov.jenkins.plugin.mvnmeta.MavenMetadataParameterDefinition.getArtifactMetadata(MavenMetadataParameterDefinition.java:258)
                  at eu.markov.jenkins.plugin.mvnmeta.MavenMetadataParameterDefinition.getVersions(MavenMetadataParameterDefinition.java:208)
          

          The Environment field of this issue says "maven-metadata-plugin 2.0.0" but those line numbers do not match https://github.com/jenkinsci/maven-metadata-plugin/blob/maven-metadata-plugin-2.0.0/src/main/lombok/eu/markov/jenkins/plugin/mvnmeta/MavenMetadataParameterDefinition.java. Is the stack trace from 2.0.0?

          Kalle Niemitalo added a comment - at eu.markov.jenkins.plugin.mvnmeta.MavenMetadataParameterDefinition.getArtifactMetadata(MavenMetadataParameterDefinition.java:258) at eu.markov.jenkins.plugin.mvnmeta.MavenMetadataParameterDefinition.getVersions(MavenMetadataParameterDefinition.java:208) The Environment field of this issue says "maven-metadata-plugin 2.0.0" but those line numbers do not match https://github.com/jenkinsci/maven-metadata-plugin/blob/maven-metadata-plugin-2.0.0/src/main/lombok/eu/markov/jenkins/plugin/mvnmeta/MavenMetadataParameterDefinition.java . Is the stack trace from 2.0.0?

          Oliver Grad added a comment -

          kon yes, we have maven-metadata-plugin-2.0.0 installed and the logs come from the jenkins.log when we produced the problem in the UI.

          Btw.

          Jackson 2 API Plugin we've installed version 2.12.4 and in the meanwhile Core 2.303.1

           

          Oliver Grad added a comment - kon yes, we have maven-metadata-plugin-2.0.0 installed and the logs come from the jenkins.log when we produced the problem in the UI. Btw. Jackson 2 API Plugin we've installed version 2.12.4 and in the meanwhile Core 2.303.1  

          Mark Waite added a comment -

          goebelp we've created a series of five videos with steps that a new contributor can use to modernize a plugin and prepare themselves to adopt the plugin. If you'd like to try adopting this plugin, you could review the videos at:

          • Part 1 - Update parent pom, update base Jenkins version, update SCM URL
          • Part 2 - More spotbugs checks, enable dependabot, enable incremental build, enable release drafter
          • Part 3 - Convert plugin documentation to GitHub, add a "Report an Issue" link
          • Part 4 - Improve dependency management with plugin bill of materials, enable automatic plugin release
          • Part 5 - Enable and process Jenkins specific security scan

          Those videos were derived from the "Contributing to Open Source" workshop that was presented at DevOps World 2021. We are preparing a tutorial for www.jenkins.io based on that workshop and on those videos. I'd love to have your feedback on the video series and/or the workshop document. We hope it helps people solve issues that they encounter and allows them to continue contributing.

          Mark Waite added a comment - goebelp we've created a series of five videos with steps that a new contributor can use to modernize a plugin and prepare themselves to adopt the plugin. If you'd like to try adopting this plugin, you could review the videos at: Part 1 - Update parent pom, update base Jenkins version, update SCM URL Part 2 - More spotbugs checks, enable dependabot, enable incremental build, enable release drafter Part 3 - Convert plugin documentation to GitHub, add a "Report an Issue" link Part 4 - Improve dependency management with plugin bill of materials, enable automatic plugin release Part 5 - Enable and process Jenkins specific security scan Those videos were derived from the "Contributing to Open Source" workshop that was presented at DevOps World 2021. We are preparing a tutorial for www.jenkins.io based on that workshop and on those videos. I'd love to have your feedback on the video series and/or the workshop document. We hope it helps people solve issues that they encounter and allows them to continue contributing.

          Peter Goebel added a comment -

          markewaite, that sounds really great.

          Unfortunate my own capacity is limited. But I will connect other colleagues if they can contribute. 

          Peter Goebel added a comment - markewaite , that sounds really great. Unfortunate my own capacity is limited. But I will connect other colleagues if they can contribute. 

          Tobias added a comment -

          Is there any way to workaround this issue locally?

          Seems like nobody feels responsible.

          Tobias added a comment - Is there any way to workaround this issue locally? Seems like nobody feels responsible.

          Mark Waite added a comment -

          Is there a way to workaround the issue locally?

          Yes. Replace the Jenkins Maven job that is currently being used with a Jenkins Pipeline or a Jenkins Freestyle project that performs the same operations.

          Seems like nobody feels responsible.

          meyestro as stated by marcrohlfs in an earlier comment, this plugin is up for adoption. When a plugin is up for adoption, that means the current maintainer is not maintaining it and others have not yet started maintaining it. I think that makes your observation correct that nobody feels responsible for this plugin at this time.

          As an open source project, Jenkins relies on the work of volunteers who are intentionally allowed to choose how much or how little they contribute. The current maintainer, marcrohlfs, is not able to commit time to maintain the plugin and has noted that the plugin is up for adoption. If others who need this plugin are willing to spend some of their time to maintain it, they can refer to the "Contributing to Open Source" document and the tutorial videos for suggestions to prepare to adopt the plugin. Fixing this issue would be a good contribution for a new maintainer. They would benefit from the fix and others would also benefit.

          Would you like to adopt the plugin?

          Mark Waite added a comment - Is there a way to workaround the issue locally? Yes. Replace the Jenkins Maven job that is currently being used with a Jenkins Pipeline or a Jenkins Freestyle project that performs the same operations. Seems like nobody feels responsible. meyestro as stated by marcrohlfs in an earlier comment , this plugin is up for adoption . When a plugin is up for adoption, that means the current maintainer is not maintaining it and others have not yet started maintaining it. I think that makes your observation correct that nobody feels responsible for this plugin at this time. As an open source project, Jenkins relies on the work of volunteers who are intentionally allowed to choose how much or how little they contribute. The current maintainer, marcrohlfs , is not able to commit time to maintain the plugin and has noted that the plugin is up for adoption. If others who need this plugin are willing to spend some of their time to maintain it, they can refer to the "Contributing to Open Source" document and the tutorial videos for suggestions to prepare to adopt the plugin. Fixing this issue would be a good contribution for a new maintainer. They would benefit from the fix and others would also benefit. Would you like to adopt the plugin?

          Tobias added a comment -

          Sorry i got no time for adoptions. I now replaced the Parameter with Active Choice Scriptler Parameter.

          If anyone wants to to similar things here:

          def host="http://0.0.0.0:8081"
          def repository=${Repository}
          def groupId=${Group_ID}.replaceAll("\\.", "/")
          def artifactId=${ArtifactID}
          def nexus_url="${host}/repository/${repository}/${groupId}/${artifactId}/maven-metadata.xml"
          def response=nexus_url.toURL().text
          def metadata = new XmlParser().parseText(response)
          
          return metadata['versioning']['versions']['version'].collect({it.text()}).reverse()
          

           

          Tobias added a comment - Sorry i got no time for adoptions. I now replaced the Parameter with Active Choice Scriptler Parameter. If anyone wants to to similar things here: def host= "http: //0.0.0.0:8081" def repository=${Repository} def groupId=${Group_ID}.replaceAll( "\\." , "/" ) def artifactId=${ArtifactID} def nexus_url= "${host}/repository/${repository}/${groupId}/${artifactId}/maven-metadata.xml" def response=nexus_url.toURL().text def metadata = new XmlParser().parseText(response) return metadata[ 'versioning' ][ 'versions' ][ 'version' ].collect({it.text()}).reverse()  

          Oliver Grad added a comment -

          With update to Jenkins Core 2.332.3 the problem is fixed in my case.

          Oliver Grad added a comment - With update to Jenkins Core 2.332.3 the problem is fixed in my case.

          Oliver Grad added a comment -

          I suggest closing the ticket.

          Oliver Grad added a comment - I suggest closing the ticket.

          Cosmin Diga added a comment -

          "With update to Jenkins Core 2.332.3 the problem is fixed in my case."
          Do we know what fixed this issue?

          Cosmin Diga added a comment - "With update to Jenkins Core 2.332.3 the problem is fixed in my case." Do we know what fixed this issue?

            marcrohlfs Marc Rohlfs
            gradol Oliver Grad
            Votes:
            4 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: