Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Caused by: java.lang.LinkageError: loader constraint violation

92 views
Skip to first unread message

kuisathaverat

unread,
Apr 16, 2025, 6:46:08 AMApr 16
to jenkin...@googlegroups.com
Hi,

I am trying to resolve an error caused by the org.jenkins-ci.main:maven-plugin:3.25 and org.jenkins-ci.plugins:apache-httpcomponents-client-4-api when I try to build a rest client. It fails with an ugly classloader error that I cannot find a way to workaround. seems like there is a different version of commons.logging, I clean up all the folders in my classpath, target, work, ... exclude common-logging in several places, force the version of common-logging at top level. And nothing works. Has anyone found something similar?

                    Caused by: java.lang.LinkageError: loader constraint violation:
                    when resolving method 'void org.apache.http.impl.auth.HttpAuthenticator.<init>(org.apache.commons.logging.Log)'
                    the class loader 'PluginClassLoader for apache-httpcomponents-client-4-api' @2afafdfc of the current class,
                      org/apache/http/impl/nio/client/MainClientExec,
                    and the class loader org.codehaus.plexus.classworlds.realm.ClassRealm @e4a177b for the method's defining class,
                      org/apache/http/impl/auth/HttpAuthenticator,
                    have different Class objects for the type org/apache/commons/logging/Log used in the signature
                    (
                        org.apache.http.impl.nio.client.MainClientExec is in unnamed module of loader 'PluginClassLoader for apache-httpcomponents-client-4-api' @2afafdfc,
                            parent loader 'dependency ClassLoader for /home/me/src/opentelemetry-plugin/work/plugins/apache-httpcomponents-client-4-api.jpi' @41c52988;
                   
                        org.apache.http.impl.auth.HttpAuthenticator is in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @e4a177b,
                            parent loader 'bootstrap'
                    )


--
Regards
Iván Fernández Calvo

Basil Crow

unread,
Apr 16, 2025, 10:57:17 AMApr 16
to jenkin...@googlegroups.com
org/apache/commons/logging/Log.class should be provided by
jcl-over-slf4j-2.0.17.jar (from SLF4J) in Jenkins core. So ensure that
no installed plugin's HPI contains WEB-INF/lib/commons-logging-*.jar
or WEB-INF/lib/jcl-over-slf4j-*.jar.

Radek Antoniuk

unread,
Apr 22, 2025, 11:27:51 AMApr 22
to Jenkins Developers
Interestingly I see the same problem in jira-plugin right now when doing tests before a new release:

I started from a clean env (no target/) and then after running mvn hpi:run I see only:
$ find target -name 'jcl-over-slf4j*'
target/jetty/webapp/WEB-INF/lib/jcl-over-slf4j-2.0.16.jar

and no commons-logging at all:
$ find target -name 'commons-log*'

Am I missing a place to look for this?

Basil Crow

unread,
Apr 22, 2025, 2:49:21 PMApr 22
to jenkin...@googlegroups.com

Ivan Fernandez Calvo

unread,
Apr 24, 2025, 2:32:27 AMApr 24
to Jenkins Developers
Basil, out of curiosity, how did you find it? I tried to find the root of the issue using 'dependency:tree', but it did not point to a culprit. Therefore, I manually dug into the dependencies of each plugin, which was a painful and slow process, and ultimately without success.

Basil Crow

unread,
Apr 24, 2025, 11:03:57 AMApr 24
to jenkin...@googlegroups.com
On Wed, Apr 23, 2025 at 11:32 PM Ivan Fernandez Calvo
<kuisat...@gmail.com> wrote:
>
> Basil, out of curiosity, how did you find it?

I followed Ranton's instructions to reproduce the problem with
hpi:run, ran dependency:tree in maven-hpi-plugin, and iterated until
the problem was resolved.

Basil Crow

unread,
Apr 24, 2025, 11:04:49 AMApr 24
to jenkin...@googlegroups.com
On Thu, Apr 24, 2025 at 8:03 AM Basil Crow <m...@basilcrow.com> wrote:
>
> I followed Ranton's instructions

Sorry, I meant Radek Antoniuk's instructions
Reply all
Reply to author
Forward
0 new messages