Dolphinscheduler3.2.1运行Java Jar路径重复的BUG修复问题

由于路径重复导致无法正确读取到Jar

bash 复制代码
[INFO] 2025-04-13 06:14:57.975 +0000 - Final Shell file is: 
[INFO] 2025-04-13 06:14:57.975 +0000 - ****************************** Script Content *****************************************************************
[INFO] 2025-04-13 06:14:57.976 +0000 - #!/bin/bash
BASEDIR=$(cd `dirname $0`; pwd)
cd $BASEDIR
${JAVA_HOME}/bin/java -classpath .:/tmp/dolphinscheduler/exec/process/hadoop/15123518621664/16374306006816_3/26335/246036:/tmp/dolphinscheduler/exec/process/hadoop/15123518621664/16374306006816_3/26335/246036//tmp/dolphinscheduler/exec/process/hadoop/15123518621664/16374306006816_3/26335/246036/game-utils-1.0-SNAPSHOT.jar -jar /tmp/dolphinscheduler/exec/process/hadoop/15123518621664/16374306006816_3/26335/246036//tmp/dolphinscheduler/exec/process/hadoop/15123518621664/16374306006816_3/26335/246036/game-utils-1.0-SNAPSHOT.jar  
[INFO] 2025-04-13 06:14:57.976 +0000 - ****************************** Script Content *****************************************************************
[INFO] 2025-04-13 06:14:57.976 +0000 - Executing shell command : sudo -u hadoop -i /tmp/dolphinscheduler/exec/process/hadoop/15123518621664/16374306006816_3/26335/246036/26335_246036.sh
[INFO] 2025-04-13 06:14:57.978 +0000 - process start, process id is: 1414860
[INFO] 2025-04-13 06:14:58.978 +0000 -  -> 
	Error: Unable to access jarfile /tmp/dolphinscheduler/exec/process/hadoop/15123518621664/16374306006816_3/26335/246036//tmp/dolphinscheduler/exec/process/hadoop/15123518621664/16374306006816_3/26335/246036/game-utils-1.0-SNAPSHOT.jar

解决办法:修改源码重新编译Dolphinscheduler3.2.1,替换dolphinscheduler-task-api-3.2.1.jar

java 复制代码
package org.apache.dolphinscheduler.plugin.task.api.shell

//BaseLinuxShellInterceptorBuilder类的 

private String shellBody() {
        if (CollectionUtils.isEmpty(scripts)) {
            return StringUtils.EMPTY;
        }
        String scriptBody = scripts
                .stream()
                .collect(Collectors.joining(System.lineSeparator()));
        //新增去除重复路径
        if(scriptBody.contains(".jar")){
            log.info("确保去除重复路径");
            scriptBody = scriptBody.replace(shellDirectory+"//","/");
        }
        scriptBody = scriptBody.replaceAll("\\r\\n", System.lineSeparator());
        return ParameterUtils.convertParameterPlaceholders(scriptBody, propertyMap);
    }

替换重启就正常了

相关推荐
老李头喽6 小时前
走进单元测试
java·单元测试
就叫飞六吧6 小时前
Spring MVC 接口命名为什么会有 *.do/actions等身影?
java·spring·mvc
葡萄成熟时 !6 小时前
黑马学生管理系统
java·开发语言
沐浴露z6 小时前
为什么使用SpringAI时通常用Builder来创建对象?详解 【Builder模式】和【直接 new】的区别
java·python·建造者模式
阿杰真不会敲代码6 小时前
Filter与Interceptor深度解析:分清这两个“拦截器”,面试不再掉坑
java·spring boot·面试
带刺的坐椅7 小时前
Solon AI 开发学习6 - chat - 两种 http 流式输入输出
java·ai·solon
客梦7 小时前
Java 道路信息系统
java·笔记
k***1958 小时前
Tomcat的升级
java·tomcat
j***49569 小时前
Windows操作系统部署Tomcat详细讲解
java·windows·tomcat