apm-agent-java icon indicating copy to clipboard operation
apm-agent-java copied to clipboard

java.lang.NoClassDefFoundError: Could not initialize class sun.net.www.protocol.https.DelegateHttpsURLConnection

Open TheCycoONE opened this issue 8 months ago • 14 comments

Describe the bug

This is an odd one, I'm seeing it in our k8s environments but not on my local machine and I don't have criteria for it, but it happens every time / with every war we're running.

{"@timestamp":"2024-06-18T17:45:53.353Z","ecs.version":"1.2.0","log.level":"INFO","message":"1 Spring WebApplicationInitializers detected on classpath","process.thread.name":"main","log.logger":"org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/rssweb]","@m":"1 Spring WebApplicationInitializers detected on classpath"}
Exception in thread "elastic-apm-remote-config-poller" java.lang.NoClassDefFoundError: Could not initialize class sun.net.www.protocol.https.DelegateHttpsURLConnection
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.<init>(HttpsURLConnectionImpl.java:82)
	at java.base/sun.net.www.protocol.https.Handler.openConnection(Handler.java:62)
	at java.base/sun.net.www.protocol.https.Handler.openConnection(Handler.java:57)
	at java.base/java.net.URL.openConnection(URL.java:1094)
	at co.elastic.apm.agent.util.UrlConnectionUtils.openUrlConnectionThreadSafely(UrlConnectionUtils.java:45)
	at co.elastic.apm.agent.report.ApmServerClient.startRequestToUrl(ApmServerClient.java:157)
	at co.elastic.apm.agent.report.ApmServerClient.execute(ApmServerClient.java:269)
	at co.elastic.apm.agent.configuration.ApmServerConfigurationSource.fetchConfig(ApmServerConfigurationSource.java:169)
	at co.elastic.apm.agent.configuration.ApmServerConfigurationSource.pollConfig(ApmServerConfigurationSource.java:139)
	at co.elastic.apm.agent.configuration.ApmServerConfigurationSource.access$000(ApmServerConfigurationSource.java:48)
	at co.elastic.apm.agent.configuration.ApmServerConfigurationSource$1.run(ApmServerConfigurationSource.java:125)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at co.elastic.apm.agent.util.ExecutorUtils$2.run(ExecutorUtils.java:99)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoClassDefFoundError: Could not initialize class sun.net.www.protocol.http.HttpURLConnection [in thread "elastic-apm-server-healthcheck"]
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.<init>(HttpsURLConnectionImpl.java:82)
	at java.base/sun.net.www.protocol.https.Handler.openConnection(Handler.java:62)
	at java.base/sun.net.www.protocol.https.Handler.openConnection(Handler.java:57)
	at java.base/java.net.URL.openConnection(URL.java:1094)
	at co.elastic.apm.agent.util.UrlConnectionUtils.openUrlConnectionThreadSafely(UrlConnectionUtils.java:45)
	at co.elastic.apm.agent.report.ApmServerClient.startRequestToUrl(ApmServerClient.java:157)
	at co.elastic.apm.agent.report.ApmServerClient.executeForAllUrls(ApmServerClient.java:294)
	at co.elastic.apm.agent.report.ApmServerHealthChecker.call(ApmServerHealthChecker.java:67)

The jdk is:

openjdk 17.0.10 2024-01-16 LTS
OpenJDK Runtime Environment Corretto-17.0.10.8.1 (build 17.0.10+8-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.10.8.1 (build 17.0.10+8-LTS, mixed mode, sharing)

The server is Apache Tomcat/9.0.87

Elastic is configured through jvm arguments as follows:

-Delastic.apm.enabled=true -Delastic.apm.service_name=rssweb -Delastic.apm.application_packages=com.example -Delastic.apm.server_url=https://redacted.example.com/apm-server -Delastic.apm.api_key=<redacted> -Delastic.apm.environment=example -Delastic.apm.log_level=OFF -Delastic.apm.disable_instrumentations=spring-service-name -Delastic.apm.ignore_urls=*/about.html

Elastic apm agent is 1.50.0

TheCycoONE avatar Jun 19 '24 19:06 TheCycoONE