diff --git a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/RestHttpGetCommandProcessor.java b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/RestHttpGetCommandProcessor.java index 79f29575a14..e692b404210 100644 --- a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/RestHttpGetCommandProcessor.java +++ b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/RestHttpGetCommandProcessor.java @@ -353,7 +353,7 @@ private SeaTunnelServer getSeaTunnelServer(boolean shouldBeMaster) { this.textCommandService.getNode().getNodeExtension().createExtensionServices(); SeaTunnelServer seaTunnelServer = (SeaTunnelServer) extensionServices.get(Constant.SEATUNNEL_SERVICE_NAME); - if (!seaTunnelServer.isMasterNode() && shouldBeMaster) { + if (shouldBeMaster && !seaTunnelServer.isMasterNode()) { return null; } return seaTunnelServer; @@ -373,8 +373,12 @@ private JsonObject convertToJson(JobInfo jobInfo, long jobId) { .getNodeEngine() .getSerializationService() .toObject(jobInfo.getJobImmutableInformation())); + SeaTunnelServer seaTunnelServer = getSeaTunnelServer(true); - ClassLoaderService classLoaderService = getSeaTunnelServer(false).getClassLoaderService(); + ClassLoaderService classLoaderService = + seaTunnelServer == null + ? getSeaTunnelServer(false).getClassLoaderService() + : seaTunnelServer.getClassLoaderService(); ClassLoader classLoader = classLoaderService.getClassLoader( jobId, jobImmutableInformation.getPluginJarsUrls()); @@ -385,7 +389,6 @@ private JsonObject convertToJson(JobInfo jobInfo, long jobId) { jobImmutableInformation.getLogicalDag()); classLoaderService.releaseClassLoader(jobId, jobImmutableInformation.getPluginJarsUrls()); - SeaTunnelServer seaTunnelServer = getSeaTunnelServer(true); String jobMetrics; JobStatus jobStatus; if (seaTunnelServer == null) {