After enabling the Java Agent, we have noticed the below error is reporting over and over in the log
How to fix or prevent the exception?
[WARN] [IntroscopeAgent.ConnectionThread] Failed to connect to the Introscope Enterprise Manager at
,com.wily.isengard.client.transport.http.tunneling.HttpsTunnelingSocketFactory (java.lang.NoClassDefFoundError:Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory).
8/27/24 12:21:40 pm BST [DEBUG] [IntroscopeAgent.ConnectionThread] Connection Exception:
java.lang.NoClassDefFoundError: Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory
at com.wily.isengard.client.transport.http.tunneling.ApacheHttpTunnelingClient.connect2(ApacheHttpTunnelingClient.java:309)
at com.wily.isengard.client.transport.http.tunneling.ApacheHttpTunnelingClient.connect(ApacheHttpTunnelingClient.java:244)
at com.wily.isengard.client.transport.http.tunneling.ApacheHttpTunnelingClient.connect(ApacheHttpTunnelingClient.java:484)
at com.wily.isengard.postofficehub.link.http.client.HttpTunnelingClientLifecycleManager.<init>(HttpTunnelingClientLifecycleManager.java:138)
at com.wily.isengard.postofficehub.link.HttpOutgoingConnection.connect(HttpOutgoingConnection.java:92)
at com.wily.isengard.postoffice.PostOfficeHub.connectToServerHub(PostOfficeHub.java:405)
at com.wily.isengard.postoffice.PostOfficeHub.connectToServerHub(PostOfficeHub.java:364)
at com.wily.isengard.api.IsengardClient.connect(IsengardClient.java:186)
at com.wily.isengard.api.IsengardClient.connect(IsengardClient.java:168)
at com.wily.introscope.agent.connection.IsengardClientConnection.connect(IsengardClientConnection.java:86)
at com.wily.introscope.agent.connection.IsengardServerConnectionManager.connectInternalAdvanced(IsengardServerConnectionManager.java:1027)
at com.wily.introscope.agent.connection.ConnectionThread.attemptAdvancedConnection(ConnectionThread.java:354)
at com.wily.introscope.agent.connection.ConnectionThread.connect(ConnectionThread.java:510)
at com.wily.introscope.agent.connection.ConnectionThread.run(ConnectionThread.java:101)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoClassDefFoundError: org/apache/logging/log4j/spi/LoggerAdapter [in thread "Agent ServerConnection"]
APM Java agent 24.x
The issue problem is related to defect DE614120 :
- the NoClassDefFoundError occurs for Agent Connection Thread only, so it should not impact the Application.
- Java Agent 24.4 logging actually uses logback instead of log4j, however some dependency libraries still using log4j, like here the apache lib for http tunneling.
Workarounds:
You can use the below options to prevent the error
1) Switch from https to websocket connection
2) HttpTunnelingTransport.jar was first introduced in 23.3, so you can use an older agent before this version.