[JIRA] (JENKINS-59410) any transitive dependency to spring, causing version conflict between shared libraries and jdk-tools plugin

10 views
Skip to first unread message

t.mnatsakanyan@gmail.com (JIRA)

unread,
Sep 17, 2019, 11:59:03 AM9/17/19
to jenkinsc...@googlegroups.com
tigran mnatsakanyan created an issue
 
Jenkins / Bug JENKINS-59410
any transitive dependency to spring, causing version conflict between shared libraries and jdk-tools plugin
Issue Type: Bug Bug
Assignee: Devin Nusbaum
Components: jdk-tool-plugin
Created: 2019-09-17 15:58
Labels: jenkins shared-groovy-libraries conflict groovy
Priority: Major Major
Reporter: tigran mnatsakanyan

If the shared library, has a transitive dependency to spring core, it is conflicting with spring jars coming from `jdk-tool` plugin.

Example.

Imagine a custom jar has a dependency on any of spring core components, ex `spring-context`

'com.company.component:library:1.0' --> `org.springframework:spring-context:4.3.8.RELEASE`

 

And lets Imagine a groovy function inside a shared library.

`doSomething.groovy`

```

@Grab('com.company.component:library:1.0')

import com.company.component.SomeClass

def call()

{  return SomeClass.doSomething() }

```

When `doSomething()` is being called from `Jenkinsfile`, everything constantly crashes with `java.lang.NoSuchMethodError`. 

 

That is because, instead of loading transitive dependencies for spring `4.3.8.RELEASE`, a classloader is loading an old `2.5.6` version of spring classes from `jdk-tool` plugin under `$JENKINS_HOME/war/WEB_INF/lib/spring-*2.5.6.jar`

 

Apparently, at the time of method execution, classloader is confused because `jdk-tool` plugin is loaded by default with old spring version. I do see grape downloading correct version of jars to $JENKINS_HOME/.groovy. However, after some debug prints ( with help of https://support.cloudbees.com/hc/en-us/articles/360004592631-What-Plugin-is-providing-this-class- ), it is visible that the classloader is ignoring the version there, and is loading from jdk-tools plugin's jars. 

 

Is there any known workaround, or possible fix to issue? 

 

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

t.mnatsakanyan@gmail.com (JIRA)

unread,
Sep 17, 2019, 11:59:04 AM9/17/19
to jenkinsc...@googlegroups.com

t.mnatsakanyan@gmail.com (JIRA)

unread,
Sep 17, 2019, 12:03:04 PM9/17/19
to jenkinsc...@googlegroups.com
tigran mnatsakanyan updated an issue
If the shared library, has a transitive dependency to spring core, it is conflicting with spring jars coming from `jdk-tool` plugin.

Example.

Imagine a custom jar has a dependency on any of spring core components, ex `spring-context`
{noformat}
' com.company.component:library:1.0' --> `org.springframework:spring-context:4.3.8.RELEASE ` {noformat}

 

And
lets let's Imagine a groovy function inside a shared library.
{noformat}

`
doSomething.groovy ` {noformat}
{code:java}
```

@Grab('com.company.component:library:1.0')

import com.company.component.SomeClass

def call()
{
{  
return SomeClass.doSomething()
}

{code }
 
```

When ` doSomething() ` is being called from ` Jenkinsfile ` , everything constantly crashes with  ` java.lang.NoSuchMethodError ` .  

 

That is because, instead of loading transitive dependencies for spring `4.3.8.RELEASE`, a classloader is loading an old `2.5.6` version of spring classes from `jdk-tool` plugin under
`

{noformat}
$JENKINS_HOME/war/ WEB_INF WEB-INF /lib/spring-*2.5.6.jar ` {noformat}

 

Apparently, at the time of method execution, classloader is confused because `jdk-tool` plugin is loaded by default with old spring version. I do see grape downloading correct version of jars to $JENKINS_HOME/.groovy. However, after some debug prints ( with help of [
cloudbees-forum|[ https://support.cloudbees.com/hc/en-us/articles/360004592631-What-Plugin-is-providing-this-class-] ), it is visible that the classloader is ignoring the version there, and is loading from jdk-tools plugin's jars. 


 

Is there any known workaround, or possible fix to issue? 

 

 

t.mnatsakanyan@gmail.com (JIRA)

unread,
Sep 17, 2019, 12:03:04 PM9/17/19
to jenkinsc...@googlegroups.com
tigran mnatsakanyan updated an issue
If the shared library, has a transitive dependency to spring core, it is conflicting with spring jars coming from `jdk-tool` plugin.

Example.

Imagine a custom jar has a dependency on any of spring core components, ex `spring-context`
{noformat}
com.company.component:library:1.0' --> `org.springframework:spring-context:4.3.8.RELEASE{noformat}
 

And let's Imagine a groovy function inside a shared library.

{noformat}
doSomething.groovy{noformat}
{code:java}
@Grab('com.company.component:library:1.0')
import com.company.component.SomeClass

def call()
{  
  return SomeClass.doSomething()
}
{code}
 

When doSomething() is being called from Jenkinsfile, everything constantly crashes with java.lang.NoSuchMethodError.


 

That is because, instead of loading transitive dependencies for spring `4.3.8.RELEASE`, a classloader is loading an old `2.5.6` version of spring classes from `jdk-tool` plugin under
{noformat}
$JENKINS_HOME/war/WEB-INF/lib/spring-*2.5.6.jar{noformat}
 
[link title|http://example.com]

Apparently, at the time of method execution, classloader is confused because `jdk-tool` plugin is loaded by default with old spring version. I do see grape downloading correct version of jars to $JENKINS_HOME/.groovy. However, after some debug prints ( with help of [cloudbees-forum|[https://support.cloudbees.com/hc/en-us/articles/360004592631-What-Plugin-is-providing-this-class-]] ), it is visible that the classloader is ignoring the version there, and is loading from jdk-tools plugin's jars. 

 

Is there any known workaround, or possible fix to issue? 

 

 

t.mnatsakanyan@gmail.com (JIRA)

unread,
Sep 17, 2019, 12:04:05 PM9/17/19
to jenkinsc...@googlegroups.com


Apparently, at the time of method execution, classloader is confused because `jdk-tool` plugin is loaded by default with old spring version. I do see grape downloading correct version of jars to $JENKINS_HOME/.groovy. However, after some debug prints ( with help of [
cloudbees- cloud bees forum|[https://support.cloudbees.com/hc/en-us/articles/360004592631-What-Plugin-is-providing-this-class-]] ), it is visible that the classloader is ignoring the version there, and is loading from jdk-tools plugin's jars. 


 

Is there any known workaround, or possible fix to issue? 

 

 

t.mnatsakanyan@gmail.com (JIRA)

unread,
Sep 17, 2019, 12:06:02 PM9/17/19
to jenkinsc...@googlegroups.com
tigran mnatsakanyan updated an issue
If the shared library, has a transitive dependency to spring core, it is conflicting with spring jars coming from `jdk-tool` plugin.

Example.

Imagine a custom jar has a dependency on any of spring core components, ex `spring-context`
{noformat}
com.company.component:library:1.0' --> `org.springframework:spring-context:4.3.8.RELEASE{noformat}
 

And let's Imagine a groovy function inside a shared library.
{ noformat code:java }
{code:title= doSomething.groovy {noformat |borderStyle=solid }
{code:java}
@Grab('com.company.component:library:1.0')
import com.company.component.SomeClass

def call()
{  
  return SomeClass.doSomething()
}
{code}
 

When doSomething() is being called from Jenkinsfile, everything constantly crashes with java.lang.NoSuchMethodError.


That is because, instead of loading transitive dependencies for spring `4.3.8.RELEASE`, a classloader is loading an old `2.5.6` version of spring classes from `jdk-tool` plugin under
{noformat}
$JENKINS_HOME/war/WEB-INF/lib/spring-*2.5.6.jar{noformat}
 

Apparently, at the time of method execution, classloader is confused because `jdk-tool` plugin is loaded by default with old spring version. I do see grape downloading correct version of jars to $JENKINS_HOME/.groovy. However, after some debug prints ( with help of  [ cloud bees cloudbees- forum|[https://support.cloudbees.com/hc/en-us/articles/360004592631-What-Plugin-is-providing-this-class-]] ), it is visible that the classloader is ignoring the version there, and is loading from jdk-tools plugin's jars. 


 

Is there any known workaround, or possible fix to issue? 

 

 

t.mnatsakanyan@gmail.com (JIRA)

unread,
Sep 17, 2019, 12:09:02 PM9/17/19
to jenkinsc...@googlegroups.com
tigran mnatsakanyan updated an issue
If the shared library, has a transitive dependency to spring core, it is conflicting with spring jars coming from `jdk-tool` plugin.

Example.

Imagine a custom jar has a dependency on any of spring core components, ex `spring-context`
{noformat}
com.company.component:library:1.0' --> `org.springframework:spring-context:4.3.8.RELEASE

{noformat}
 

And let's Imagine a groovy function inside a shared library.
{code:java}
 
{code:title=doSomething.groovy|borderStyle=solid}


@Grab('com.company.component:library:1.0')

import com.company.component.SomeClass


def call()
{  
  return SomeClass.doSomething()


}

{code}
 


When doSomething() is being called from Jenkinsfile, everything constantly crashes with java.lang.NoSuchMethodError.

 [cloud bees forum|[https://support.cloudbees.com/hc/en-us/articles/360004592631-What-Plugin-is-providing-this-class-]]

That is because, instead of loading transitive dependencies for spring `4.3.8.RELEASE`, a classloader is loading an old `2.5.6` version of spring classes from `jdk-tool` plugin under
{noformat}
$JENKINS_HOME/war/WEB-INF/lib/spring-*2.5.6.jar{noformat}
 

Apparently, at the time of method execution, classloader is confused because `jdk-tool` plugin is loaded by default with old spring version. I do see grape downloading correct version of jars to $JENKINS_HOME/.groovy. However, after some debug prints ( with help of [cloudbees-forum| [https://support.cloudbees.com/hc/en-us/articles/360004592631-What-Plugin-is-providing-this-class-]] ), it is visible that the classloader is ignoring the version there, and is loading from jdk-tools plugin's jars. 


 

Is there any known workaround, or possible fix to issue? 

 

 

t.mnatsakanyan@gmail.com (JIRA)

unread,
Sep 17, 2019, 12:10:02 PM9/17/19
to jenkinsc...@googlegroups.com
tigran mnatsakanyan updated an issue
If the shared library, has a transitive dependency to spring core, it is conflicting with spring jars coming from `jdk-tool` plugin.

Example.

Imagine a custom jar has a dependency on any of spring core components, ex `spring-context`
{noformat}
com.company.component:library:1.0' --> `org.springframework:spring-context:4.3.8.RELEASE
{noformat}
 

And let's Imagine a groovy function inside a shared library.

 
{code:title=doSomething.groovy|borderStyle=solid}

@Grab('com.company.component:library:1.0')

import com.company.component.SomeClass
def call() {  
     return SomeClass.doSomething()
}

{code}



When doSomething() is being called from Jenkinsfile, everything constantly crashes with java.lang.NoSuchMethodError.

That is because, instead of loading transitive dependencies for spring `4.3.8.RELEASE`, a classloader is loading an old `2.5.6` version of spring classes from `jdk-tool` plugin under
{noformat}
$JENKINS_HOME/war/WEB-INF/lib/spring-*2.5.6.jar{noformat}
 

Apparently, at the time of method execution, classloader is confused because `jdk-tool` plugin is loaded by default with old spring version. I do see grape downloading the correct version of jars to $JENKINS_HOME/.groovy. However, after some debug prints ( with help of [ cloudbees- cloud bees forum| [ https://support.cloudbees.com/hc/en-us/articles/360004592631-What-Plugin-is-providing-this-class-] ]  ), it is visible that the classloader is ignoring the version there, and is loading from jdk-tools plugin's jars. 


 

Is there any known workaround, or possible fix to issue? 

 

 
Reply all
Reply to author
Forward
0 new messages