Spring Boot 在使用Java Springboot执行的Pentaho作业中执行子转换

enxuqcxy  于 2022-11-05  发布在  Spring
关注(0)|答案(1)|浏览(161)

我尝试使用Springboot执行Pentaho作业和转换,并且成功执行了这两个作业。但是,当我尝试执行Pentaho作业时,出现的问题是,该作业中链接了我使用${Internal.Job.Filename.Directory}参数连接的转换。它在Pentaho PDI中工作成功,但当我尝试使用Springboot代码执行它时,我遇到了以下错误:

2022/10/10 10:51:04 - data-fetch - Starting entry [Check S3 DB Connections]
2022-10-10T10:51:04.632+0530
      (org.pentaho.di.job.Job) [http-nio-8085-exec-10] INFO   - [src/main/resources/pentaho/data-fetch.kjb]  Starting entry [Check S3 DB Connections]
2022/10/10 10:51:14 - data-fetch - Starting entry [S3-Transformation]
2022-10-10T10:51:14.828+0530
      (org.pentaho.di.job.Job) [http-nio-8085-exec-10] INFO   - [src/main/resources/pentaho/data-fetch.kjb]  Starting entry [S3-Transformation]
2022/10/10 10:51:14 - S3-Transformation - ERROR (version 9.0.0.1-497, build 9.0.0.1-497 from 2020-03-19 08.25.00 by buildguy) : Unable to run job data-fetch. The S3-Transformation has an error. The transformation path ${Internal.Job.Filename.Directory}/S3-fetch.ktr is invalid, and will not run successfully.
2022/10/10 10:51:14 - S3-Transformation - ERROR (version 9.0.0.1-497, build 9.0.0.1-497 from 2020-03-19 08.25.00 by buildguy) : org.pentaho.di.core.exception.KettleXMLException: 
2022/10/10 10:51:14 - S3-Transformation - The transformation path ${Internal.Job.Filename.Directory}/S3-fetch.ktr is invalid, and will not run successfully.

我是否应该使用其他参数?

kknvjkwl

kknvjkwl1#

所以Pentaho没有提供自动启用运行时变量的功能,我们需要在执行过程中显式地提供它们。我添加了下面一行代码来添加它,它成功地执行了。

job.setVariable("Internal.Job.Filename.Directory", pentahoDir);​

其中,pentahoDir是指向目录绝对路径的变量,需要由用户设置。

相关问题