dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

[Question] [Worker] Workflow Definition JAVA

Open Smilewh888 opened this issue 2 years ago • 5 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

What happened

1. It was started docker-compose ,I have defined the workflow error for JAVA language as follows [{"prop":"name","direct":"IN","type":"VARCHAR","value":"superadmin"}] successfully [INFO] 2023-12-18 15:53:02.815 +0800 - *********************************************************************************************** [INFO] 2023-12-18 15:53:02.815 +0800 - ********************************* Execute task instance ************************************* [INFO] 2023-12-18 15:53:02.815 +0800 - *********************************************************************************************** [INFO] 2023-12-18 15:53:02.815 +0800 - The current java source code will begin to replace the placeholder: public class HelloUser{

public static void main(String[] args){

    if("superadmin".equals("${name}"){
         System.out.println("this is superadmin!");
    }
    System.out.println("Hello: ${name}");
}

} [INFO] 2023-12-18 15:53:02.816 +0800 - tenantCode: default, task dir:/tmp/dolphinscheduler/exec/process/default/11926875436032/11929388222080_8/12/27 [INFO] 2023-12-18 15:53:02.816 +0800 - the java source code:/tmp/dolphinscheduler/exec/process/default/11926875436032/11929388222080_8/12/27/HelloUser.java, will be write to the file: public class HelloUser{

public static void main(String[] args){

    if("superadmin".equals("superadmin"){
         System.out.println("this is superadmin!");
    }
    System.out.println("Hello: superadmin");
}

} [INFO] 2023-12-18 15:53:02.817 +0800 - Final Shell file is : #!/bin/bash BASEDIR=$(cd dirname $0; pwd) cd $BASEDIR ${JAVA_HOME}/bin/javac --class-path .:/tmp/dolphinscheduler/exec/process/default/11926875436032/11929388222080_8/12/27 /tmp/dolphinscheduler/exec/process/default/11926875436032/11929388222080_8/12/27/HelloUser.java;${JAVA_HOME}/bin/java --class-path .:/tmp/dolphinscheduler/exec/process/default/11926875436032/11929388222080_8/12/27 HelloUser
[INFO] 2023-12-18 15:53:02.817 +0800 - Executing shell command : sudo -u root -i /tmp/dolphinscheduler/exec/process/default/11926875436032/11929388222080_8/12/27/12_27.sh [INFO] 2023-12-18 15:53:02.821 +0800 - process start, process id is: 4900 [INFO] 2023-12-18 15:53:03.821 +0800 - -> /tmp/dolphinscheduler/exec/process/default/11926875436032/11929388222080_8/12/27/12_27.sh: line 4: /bin/javac: No such file or directory /tmp/dolphinscheduler/exec/process/default/11926875436032/11929388222080_8/12/27/12_27.sh: line 4: /bin/java: No such file or directory [INFO] 2023-12-18 15:53:03.823 +0800 - process has exited. execute

2.According to the logs, the JAVA file cannot be found on the server. I don't know why? image

What you expected to happen

normal

How to reproduce

Docker Quick Start tar -zxf apache-dolphinscheduler-3.2.0-src.tar.gz cd apache-dolphinscheduler-3.2.0-src/deploy/docker docker-compose --profile schema up -d docker-compose --profile all up -d image

Anything else

No response

Version

3.2.0

Are you willing to submit PR?

  • [X] Yes I am willing to submit a PR!

Code of Conduct

Smilewh888 avatar Dec 18 '23 08:12 Smilewh888

请问要使JAVA组件运行起来,在哪里设置JDK呢?

lixianli1987 avatar Dec 18 '23 13:12 lixianli1987

请问要使JAVA组件运行起来,在哪里设置JDK呢?

我用docker-compose启动的,容器就有jdk,并且能输出JAVA_HOME

Smilewh888 avatar Dec 19 '23 01:12 Smilewh888

You can set the JAVA_HOME in the UI, you can choose the environment when you set the task

image

image

davidzollo avatar Dec 24 '23 13:12 davidzollo

This issue has been automatically marked as stale because it has not had recent activity for 30 days. It will be closed in next 7 days if no further activity occurs.

github-actions[bot] avatar Jan 24 '24 00:01 github-actions[bot]

@Smilewh888 please fix according to https://github.com/apache/dolphinscheduler/issues/15334#issuecomment-1868516801

zhongjiajie avatar Jan 30 '24 07:01 zhongjiajie