Avoid using ServletException from SlaveComputer since it can break calls to SlaveComputer.getChannelToMaster.
java.lang.NoClassDefFoundError: javax/servlet/ServletException
at hudson.util.ProcessTree.get(ProcessTree.java:399)
@@ -76,7 +76,6 @@ import org.kohsuke.stapler.interceptor.RequirePOST;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.OverridingMethodsMustInvokeSuper;
-import javax.servlet.ServletException;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -716,7 +715,7 @@ public class SlaveComputer extends Computer {
}
@RequirePOST
- public HttpResponse doDoDisconnect(@QueryParameter String offlineMessage) throws IOException, ServletException {
+ public HttpResponse doDoDisconnect(@QueryParameter String offlineMessage) {
if (channel!=null) {
//does nothing in case computer is already disconnected
checkPermission(DISCONNECT);
@@ -741,11 +740,18 @@ public class SlaveComputer extends Computer {
}
@RequirePOST
- public void doLaunchSlaveAgent(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
+ @Override
+ public void doLaunchSlaveAgent(StaplerRequest req, StaplerResponse rsp) throws IOException {
checkPermission(CONNECT);
if(channel!=null) {
+ try {
req.getView(this, "already-launched.jelly").forward(req, rsp);
+ } catch (IOException x) {
+ throw x;
+ } catch (/*Servlet*/Exception x) {
+ throw new IOException(x);
+ }
return;
}
@@ -778,7 +784,7 @@ public class SlaveComputer extends Computer {
}
@WebMethod(name="slave-agent.jnlp")
- public HttpResponse doSlaveAgentJnlp(StaplerRequest req, StaplerResponse res) throws IOException, ServletException {
+ public HttpResponse doSlaveAgentJnlp(StaplerRequest req, StaplerResponse res) {
return new EncryptedSlaveAgentJnlpFile(this, "slave-agent.jnlp.jelly", getName(), CONNECT);
}
