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

maven-metadata-plugin shows ClassCastException

    XMLWordPrintable

Details

    Description

      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)
      

      Attachments

        Activity

          cozappz 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?

          cozappz 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?
          gradol Oliver Grad added a comment -

          I suggest closing the ticket.

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

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

          gradol Oliver Grad added a comment - With update to Jenkins Core 2.332.3 the problem is fixed in my case.
          meyestro 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()
          

           

          meyestro 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()  
          markewaite 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?

          markewaite 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?

          People

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

            Dates

              Created:
              Updated: