question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No httpclient implementations found on the context classloader in Groovy 3.0.11 in JMeter 5.5

See original GitHub issue

Describe the bug

Below is my code where I am trying to get the list of pods from the default namespace in Groovy 3.0.11 in JMeter 5.5.

But it is throwing the No httpclient implementations found on the context classloader, please ensure your classpath includes an implementation jar error. Please see the below error for more details.

import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClientBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Grab(group='io.fabric8', module='kubernetes-client', version='6.0.0-RC1')
@Grab(group='io.fabric8', module='knative-client', version='6.0.0-RC1')
@Grab(group='io.fabric8', module='kubernetes-client-api', version='6.0.0-RC1')
@Grab(group='org.slf4j', module='slf4j-api', version='2.0.0-alpha7')

Logger logger = LoggerFactory.getLogger(this.class);

KubernetesClient k8s = new KubernetesClientBuilder().build()

k8s.pods().inNamespace("default").list().getItems()
.forEach(pod ->
        println pod.getMetadata().getName()
)

Error

javax.script.ScriptException: io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
javax.script.ScriptException: io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320) ~[groovy-jsr223-3.0.11.jar:3.0.11]
	at org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:71) ~[groovy-jsr223-3.0.11.jar:3.0.11]
	at javax.script.CompiledScript.eval(CompiledScript.java:93) ~[java.scripting:?]
	at org.apache.jmeter.util.JSR223TestElement.processFileOrScript(JSR223TestElement.java:217) ~[ApacheJMeter_core.jar:5.5]
	at org.apache.jmeter.protocol.java.sampler.JSR223Sampler.sample(JSR223Sampler.java:72) ~[ApacheJMeter_java.jar:5.5]
	at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:651) ~[ApacheJMeter_core.jar:5.5]
	at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:570) ~[ApacheJMeter_core.jar:5.5]
	at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:501) ~[ApacheJMeter_core.jar:5.5]
	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:268) ~[ApacheJMeter_core.jar:5.5]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:103) ~[?:?]
	at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:97) ~[?:?]
	at io.fabric8.kubernetes.client.KubernetesClientBuilder.build(KubernetesClientBuilder.java:76) ~[?:?]
	at io.fabric8.kubernetes.client.KubernetesClientBuilder$build.call(Unknown Source) ~[?:?]
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) ~[groovy-3.0.11.jar:3.0.11]
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) ~[groovy-3.0.11.jar:3.0.11]
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130) ~[groovy-3.0.11.jar:3.0.11]
	at Script7.run(Script7.groovy:13) ~[?:?]
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) ~[groovy-jsr223-3.0.11.jar:3.0.11]
	... 9 more
Caused by: java.lang.reflect.InvocationTargetException
	at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:79) ~[?:?]
	at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:483) ~[?:?]
	at io.fabric8.kubernetes.client.KubernetesClientBuilder.build(KubernetesClientBuilder.java:69) ~[?:?]
	at io.fabric8.kubernetes.client.KubernetesClientBuilder$build.call(Unknown Source) ~[?:?]
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) ~[groovy-3.0.11.jar:3.0.11]
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) ~[groovy-3.0.11.jar:3.0.11]
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130) ~[groovy-3.0.11.jar:3.0.11]
	at Script7.run(Script7.groovy:13) ~[?:?]
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) ~[groovy-jsr223-3.0.11.jar:3.0.11]
	... 9 more
Caused by: io.fabric8.kubernetes.client.KubernetesClientException: No httpclient implementations found on the context classloader, please ensure your classpath includes an implementation jar
	at io.fabric8.kubernetes.client.utils.HttpClientUtils.createHttpClient(HttpClientUtils.java:171) ~[?:?]
	at io.fabric8.kubernetes.client.DefaultKubernetesClient.<init>(DefaultKubernetesClient.java:153) ~[?:?]
	at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67) ~[?:?]
	at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:483) ~[?:?]
	at io.fabric8.kubernetes.client.KubernetesClientBuilder.build(KubernetesClientBuilder.java:69) ~[?:?]
	at io.fabric8.kubernetes.client.KubernetesClientBuilder$build.call(Unknown Source) ~[?:?]
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) ~[groovy-3.0.11.jar:3.0.11]
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) ~[groovy-3.0.11.jar:3.0.11]
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130) ~[groovy-3.0.11.jar:3.0.11]
	at Script7.run(Script7.groovy:13) ~[?:?]
	at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) ~[groovy-jsr223-3.0.11.jar:3.0.11]
	... 9 more

Fabric8 Kubernetes Client version

6.0.0-RC1

Steps to reproduce

  1. import the fabric8 directives
  2. Execute the above code in JMeter 5.5, which has Groovy 3.0.11
  3. Exceptions can be seen.

Expected behavior

No errors.

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

other (please specify in additional context)

Environment

Windows, Linux, other (please specify in additional context)

Fabric8 Kubernetes Client Logs

No response

Additional context

  • tried in 5.12.2 as well, same issue

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
iocanelcommented, Jul 7, 2022

In other words, yeah I think that the issue will be solved by leveraging TCL / current class classloader.

1reaction
manusacommented, Jul 12, 2022

I’m testing this with Groovy (4.0.3 ), and it works for me.

Tested Script:

@Grab(group='io.fabric8', module='kubernetes-client', version='6.0.0-RC1')
@Grab(group='io.fabric8', module='kubernetes-client-api', version='6.0.0-RC1')

import io.fabric8.kubernetes.client.KubernetesClient
import io.fabric8.kubernetes.client.KubernetesClientBuilder

try (KubernetesClient client = new KubernetesClientBuilder().build()) {

    client.pods().inNamespace("default").list().getItems()
        .forEach(pod ->
            println pod.getMetadata().getName()
        )
}

The same script on JMeter fails. However, note that JMeter is using Groovy 3.0.11. I’m not sure if the classloader issues are caused by the groovy engine or JMeter itself when invoking the scripts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

fabric8io - Bountysource
No httpclient implementations found on the context classloader in Groovy ... get the list of pods from the default namespace in Groovy 3.0.11...
Read more >
Search Results - CVE
Apache Calcite Avatica JDBC driver creates HTTP client instances based on class names provided via `httpclient_impl` connection property; however, the driver ...
Read more >
Full Graph Limited MVN Deps.pdf - WordPress.com
org.codehaus.groovy.maven.runtime.gmaven-runtime-1.6-1.0-rc-5 org.eclipse.ecf.example.collab.editor-1.0.0-v20070627-1030 org.apache.derby.derby-10.4.1.3.
Read more >
View All Attachments for Bug 583288 - Gentoo's Bugzilla
0 Tue May 10 10:07:26 2016 >>> kde-plasma/kde-cli-tools-5.5.5 Tue May 10 10:08:55 2016 >>> kde-apps/khelpcenter-5.5.5 Tue May 10 10:46:27 2016 >>> kde-base/ ...
Read more >
Compare Packages Between Distributions - DistroWatch.com
In this way we can not only compare two competing projects, but also track the progress ... apache-commons-httpclient-3.1_2.pkg ... apache-jmeter-2.11_3.pkg
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found