Reputation: 3
We have a networking service which runs inside a container and needs to execute commands on the host vm via ssh session. ( The host vm is the main operating environment for the product)
We use sshj-0.35.0 library to have ssh connection with the host vm . We are getting error when ssh connection is getting disconnected after executing the commands.
This issue is intermittent and occurs only when service gets restarted.(found in 3 out of 10 restarts )
java.lang.NoClassDefFoundError: net/schmizz/sshj/common/DisconnectReason
at net.schmizz.sshj.common.SSHException.toString(SSHException.java:92) ~[sshj-0.35.0.jar!/:?]
at net.schmizz.sshj.AbstractService.notifyError(AbstractService.java:57) ~[sshj-0.35.0.jar!/:?]
at net.schmizz.sshj.connection.ConnectionImpl.notifyError(ConnectionImpl.java:255) ~[sshj-0.35.0.jar!/:?]
at net.schmizz.sshj.transport.TransportImpl.disconnect(TransportImpl.java:406) ~[sshj-0.35.0.jar!/:?]
at net.schmizz.sshj.transport.TransportImpl.disconnect(TransportImpl.java:397) ~[sshj-0.35.0.jar!/:?]
at net.schmizz.sshj.transport.TransportImpl.disconnect(TransportImpl.java:392) ~[sshj-0.35.0.jar!/:?]
at net.schmizz.sshj.SSHClient.disconnect(SSHClient.java:439) ~[sshj-0.35.0.jar!/:?]
at com.foo.bar.common.util.SSHUtil2.copyFromRemote(SSHUtil2.java:1079) ~[common-util-1.5.0.0.jar!/:?]
at com.foo.bar.connectivity.base.service.PrivateDNSEditorService.deleteAllCustomDNSEntries(PrivateDNSEditorService.java:80) ~[connectivity-base-1.5.0.0.jar!/:?]
at com.foo.bar.connectivity.onboarding.tasks.CleanupInternalDNSEntriesTask.execute(CleanupInternalDNSEntriesTask.java:42) ~[connectivity-orchestration-1.5.0.0.jar!/:?]
at com.foo.bar.workflow.service.WorkflowTask.run(WorkflowTask.java:74) [foo-workflow-1.5.0.0.jar!/:?]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at java.base/java.lang.Thread.run(Thread.java:842) [?:?]
Caused by: java.lang.ClassNotFoundException: net.schmizz.sshj.common.DisconnectReason
... 14 more
The SSHException.java is trying to access DisconnectReason enum .Both are located in the same package in the sshj jar which confirms that the dependency jar is present in the classpath at runtime . Only problem is jvm is not able to find/load DisconnectReason.java.
I checked the logs for any ExceptionInInitializerError prior to this error but I couldn't find any.
I upgraded the sshj jar to 0.38.0 version but that caused failures in other features so I had to revert it. (I did not get a chance to test against upgraded version 0.38.0as the failures were seen in early stages in our workflow ).
one observation- When I run the service with -verbose:class jvm argument and check the classloader logs, sometimes the enum is not loaded at the startup. I don't see any errors. Can somebody suggest any ways to debug and find the root cause of this issue?
Upvotes: 0
Views: 176