521daichen opened a new issue, #3748:
URL: https://github.com/apache/incubator-seatunnel/issues/3748

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   
   ### What happened
   
   Seatunnel 2.3.0-beta version, the udf class cannot be loaded, but the class 
has been placed in the lib directory of flink
   
   ### SeaTunnel Version
   
   2.3.0-beta
   
   ### SeaTunnel Config
   
   ```conf
   env {
     execution.parallelism = 1
   }
   
   source {
       JdbcSource {
           result_table_name = "test"
           url = "jdbc:mysql://localhost/t"
           driver = "com.mysql.cj.jdbc.Driver"
           username = "root"
           password = "123456789"
           query = "select name from test"
       }
   }
   
   
   transform {
       udf {
           function.with_dylan = "com.qq.qidian.flinkUdf.WithDylan"
       }
       sql {
           result_table_name = "t1"
           sql = "select with_dylan(t1.name) as `name`, t2.age as `age` from 
test as t1 inner join test_middle as t2 on t1.name=t2.name"
       }
   }
   
   sink {
       JdbcSink {
           source_table_name = "t1"
           driver = "com.mysql.cj.jdbc.Driver"
           url = "jdbc:mysql://localhost:3306/t"
           username = root
           password = 123456789
           query = "insert into test_sink(name, age) values(?,?)"
       }
   }
   ```
   
   
   ### Running Command
   
   ```shell
   ./bin/start-seatunnel-flink.sh --config ./config/2.conf
   ```
   
   
   ### Error Exception
   
   ```log
   ➜  apache-seatunnel-incubating-2.3.0-beta ./bin/start-seatunnel-flink.sh 
--config ./config/2.conf
   Export JVM_ARGS: -Dexecution.parallelism=1
   Execute SeaTunnel Flink Job: ${FLINK_HOME}/bin/flink run -c 
org.apache.seatunnel.core.flink.SeatunnelFlink 
/Users/dylan/flink/apache-seatunnel-incubating-2.3.0-beta/lib/seatunnel-core-flink.jar
 --config ./config/2.conf
   
   ------------------------------------------------------------
    The program finished with the following exception:
   
   org.apache.flink.client.program.ProgramInvocationException: The main method 
caused an error: Execute Flink task error
        at 
org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:372)
        at 
org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:222)
        at 
org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114)
        at 
org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:812)
        at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:246)
        at 
org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1054)
        at 
org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1132)
        at 
org.apache.flink.runtime.security.contexts.NoOpSecurityContext.runSecured(NoOpSecurityContext.java:28)
        at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1132)
   Caused by: org.apache.seatunnel.core.base.exception.CommandExecuteException: 
Execute Flink task error
        at 
org.apache.seatunnel.core.flink.command.FlinkApiTaskExecuteCommand.execute(FlinkApiTaskExecuteCommand.java:84)
        at org.apache.seatunnel.core.base.Seatunnel.run(Seatunnel.java:39)
        at 
org.apache.seatunnel.core.flink.SeatunnelFlink.main(SeatunnelFlink.java:34)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:355)
        ... 8 more
   Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: 
com.qq.qidian.flinkUdf.WithDylan
        at 
org.apache.seatunnel.flink.transform.UDF.registerFunction(UDF.java:71)
        at 
org.apache.seatunnel.flink.batch.FlinkBatchExecution.start(FlinkBatchExecution.java:64)
        at 
org.apache.seatunnel.core.flink.command.FlinkApiTaskExecuteCommand.execute(FlinkApiTaskExecuteCommand.java:82)
        ... 15 more
   Caused by: java.lang.ClassNotFoundException: com.qq.qidian.flinkUdf.WithDylan
        at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at 
org.apache.flink.util.FlinkUserCodeClassLoader.loadClassWithoutExceptionHandling(FlinkUserCodeClassLoader.java:64)
        at 
org.apache.flink.util.ChildFirstClassLoader.loadClassWithoutExceptionHandling(ChildFirstClassLoader.java:74)
        at 
org.apache.flink.util.FlinkUserCodeClassLoader.loadClass(FlinkUserCodeClassLoader.java:48)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at 
org.apache.seatunnel.flink.transform.UDF.registerFunction(UDF.java:68)
        ... 17 more
   ```
   
   
   ### Flink or Spark Version
   
   flink 1.13.0
   
   ### Java or Scala Version
   
   jdk8
   
   ### Screenshots
   
   <img width="1199" alt="image" 
src="https://user-images.githubusercontent.com/21999616/208224831-c2e042f2-a9a6-41da-bf3f-60a9d639baf8.png";>
   
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to