Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-62006

Getting java.lang.ClassNotFoundException: javax.servlet.ServletException while running hudson.util.ProcessTree.get()

XMLWordPrintable

    • Jenkins 2.285, 2.277.2 released Apr 7, 2021

      When running Kubernetes agents, upon shutting them down (not sure how that is related), I sometimes get the following stacktrace

       

      AVERTISSEMENT: failed to shut down 1c62c2d9-920c-479c-94fe-9292dea21a67
      java.io.IOException: Remote call on JNLP4-connect connection from localhost/127.0.0.1:53049 failed
      	at hudson.remoting.Channel.call(Channel.java:1004)
      	at hudson.Launcher$RemoteLauncher.kill(Launcher.java:1083)
      	at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask$2.run(ExecutorStepExecution.java:740)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
      	at java.util.concurrent.FutureTask.run(FutureTask.java)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletException
      	at hudson.util.ProcessTree.get(ProcessTree.java:432)
      	at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1100)
      	at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1091)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      	at hudson.remoting.Request$2.run(Request.java:369)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:117)
      	... 1 more
      	Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from localhost/127.0.0.1:53049
      		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1788)
      		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
      		at hudson.remoting.Channel.call(Channel.java:998)
      		at hudson.Launcher$RemoteLauncher.kill(Launcher.java:1083)
      		at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask$2.run(ExecutorStepExecution.java:740)
      		at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      		at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
      		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      		at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
      		at java.util.concurrent.FutureTask.run(FutureTask.java)
      		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      		... 1 more
      Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletException
      	at hudson.remoting.RemoteClassLoader$ClassLoaderProxy.fetch(RemoteClassLoader.java:811)
      	at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:931)
      	at hudson.remoting.Request$2.run(Request.java:369)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      	at org.jenkinsci.remoting.CallableDecorator.call(CallableDecorator.java:18)
      	at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
      	at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
      	at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
      	at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
      	at java.util.concurrent.FutureTask.run(FutureTask.java)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	... 1 more
      	Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection to host.docker.internal/192.168.65.2:52872
      		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1737)
      		at hudson.remoting.Request.call(Request.java:202)
      		at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:288)
      		at com.sun.proxy.$Proxy5.fetch(Unknown Source)
      		at hudson.remoting.RemoteClassLoader.findClass(RemoteClassLoader.java:317)
      		at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
      		at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
      		at hudson.util.ProcessTree.get(ProcessTree.java:432)
      		at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1100)
      		at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:1091)
      		at hudson.remoting.UserRequest.perform(UserRequest.java:211)
      		at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      		at hudson.remoting.Request$2.run(Request.java:369)
      		at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      		at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      		at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:117)
      		... 1 more 

      My interpretation is that loading SlaveComputer on the agent JVM causes ServletException to be pulled (because it is in the signature of several methods of Computer).

      I believe moving the method over to a separate utility class without ties to ServletException would prevent this problem to occur.

            Unassigned Unassigned
            vlatombe Vincent Latombe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: