SpringBoot调用Kettle常见错误

场景:通过kettle工具制作 表->文件 导出的转换作业,由SpringBoot程序调用该产生的ktr文件

  • 错误:无法生成导出的文件

Could not find file with URI "..." because it is a relative path, and no base URI was provided.

___  ___       ______         _    _        ______  _             
|  \/  |       | ___ \       | |  (_)       | ___ \| |            
| .  . | _   _ | |_/ /  __ _ | |_  _  ___   | |_/ /| | _   _  ___ 
| |\/| || | | || ___ \ / _` || __|| |/ __|  |  __/ | || | | |/ __|
| |  | || |_| || |_/ /| (_| || |_ | |\__ \  | |    | || |_| |\__ \
\_|  |_/ \__, |\____/  \__,_| \__||_||___/  \_|    |_| \__,_||___/
          __/ |                                                   
         |___/                                              3.0-RELEASE

2020-05-06 14:25:36.768 [main] INFO  com.alibaba.druid.pool.DruidDataSource - {dataSource-1} inited
Wed May 06 14:25:36 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2020-05-06 14:25:38.555 [main] INFO  o.s.scheduling.concurrent.ThreadPoolTaskExecutor - Initializing ExecutorService 'applicationTaskExecutor'
2020-05-06 14:25:40.435 [main] INFO  o.s.b.actuate.endpoint.web.EndpointLinksResolver - Exposing 2 endpoint(s) beneath base path '/actuator'
2020-05-06 14:25:40.531 [main] INFO  com.yqzl.extract.utils.kettle.TestKettleUtil - Started TestKettleUtil in 9.631 seconds (JVM running for 11.209)
2020/05/06 14:25:41 - db2file - 为了转换解除补丁开始  [db2file]
2020-05-06 14:25:41.068 [main] INFO  org.pentaho.di.trans.Trans - [src/main/resources/kjb/db2file1.ktr]  为了转换解除补丁开始  [db2file]
Wed May 06 14:25:41 CST 2020 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2020-05-06 14:25:41.135 [Thread-9] INFO  o.s.scheduling.concurrent.ThreadPoolTaskExecutor - Shutting down ExecutorService 'applicationTaskExecutor'
2020-05-06 14:25:41.153 [Thread-9] INFO  com.alibaba.druid.pool.DruidDataSource - {dataSource-1} closed
org.pentaho.di.core.exception.KettleFileException: 

Unable to get VFS File object for filename 'D:/data/kettle/2020-05-06/abc_20200506.txt' : Could not find file with URI "D:\data\kettle\2020-05-06\abc_20200506.txt" because it is a relative path, and no base URI was provided.
Could not find file with URI "D:\data\kettle\2020-05-06\abc_20200506.txt" because it is a relative path, and no base URI was provided.

Could not find file with URI "D:\data\kettle\2020-05-06\abc_20200506.txt" because it is a relative path, and no base URI was provided.

	at org.pentaho.di.core.vfs.KettleVFS.getFileObject(KettleVFS.java:171)
	at org.pentaho.di.core.vfs.KettleVFS.getFileObject(KettleVFS.java:117)
	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.getFileObject(TextFileOutput.java:1036)
	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.initFileStreamWriter(TextFileOutput.java:156)
	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.writeRowToFile(TextFileOutput.java:355)
	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.writeRowTo(TextFileOutput.java:468)
	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.processRow(TextFileOutput.java:461)
	at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.commons.vfs2.FileSystemException: Could not find file with URI "D:\data\kettle\2020-05-06\abc_20200506.txt" because it is a relative path, and no base URI was provided.
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:731)
	at org.pentaho.di.core.vfs.ConcurrentFileSystemManager.resolveFile(ConcurrentFileSystemManager.java:91)
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:677)
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:632)
	at org.pentaho.di.core.vfs.KettleVFS.myGetFileObject(KettleVFS.java:177)
	at org.pentaho.di.core.vfs.KettleVFS.getFileObject(KettleVFS.java:167)
	... 8 more
2020/05/06 14:25:41 - 文本文件输出.0 - ERROR (version 9.0.0.0-423, build 9.0.0.0-423 from 2020-01-31 04.53.04 by buildguy) : Unexpected error
2020-05-06 14:25:41.156 [db2file - 文本文件输出] ERROR org.pentaho.di.trans.Trans - [src/main/resources/kjb/db2file1.ktr]  Unexpected error
2020-05-06 14:25:41.157 [db2file - 文本文件输出] ERROR org.pentaho.di.trans.Trans - [src/main/resources/kjb/db2file1.ktr]  org.pentaho.di.core.exception.KettleFileException: 

Unable to get VFS File object for filename 'D:/data/kettle/2020-05-06/abc_20200506.txt' : Could not find file with URI "D:\data\kettle\2020-05-06\abc_20200506.txt" because it is a relative path, and no base URI was provided.
Could not find file with URI "D:\data\kettle\2020-05-06\abc_20200506.txt" because it is a relative path, and no base URI was provided.

Could not find file with URI "D:\data\kettle\2020-05-06\abc_20200506.txt" because it is a relative path, and no base URI was provided.

	at org.pentaho.di.core.vfs.KettleVFS.getFileObject(KettleVFS.java:171)
	at org.pentaho.di.core.vfs.KettleVFS.getFileObject(KettleVFS.java:117)
	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.getFileObject(TextFileOutput.java:1036)
	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.initFileStreamWriter(TextFileOutput.java:156)
	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.writeRowToFile(TextFileOutput.java:355)
	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.writeRowTo(TextFileOutput.java:468)
	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.processRow(TextFileOutput.java:461)
	at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.commons.vfs2.FileSystemException: Could not find file with URI "D:\data\kettle\2020-05-06\abc_20200506.txt" because it is a relative path, and no base URI was provided.
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:731)
	at org.pentaho.di.core.vfs.ConcurrentFileSystemManager.resolveFile(ConcurrentFileSystemManager.java:91)
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:677)
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:632)
	at org.pentaho.di.core.vfs.KettleVFS.myGetFileObject(KettleVFS.java:177)
	at org.pentaho.di.core.vfs.KettleVFS.getFileObject(KettleVFS.java:167)
	... 8 more

2020/05/06 14:25:41 - 文本文件输出.0 - ERROR (version 9.0.0.0-423, build 9.0.0.0-423 from 2020-01-31 04.53.04 by buildguy) : org.pentaho.di.core.exception.KettleFileException: 
2020/05/06 14:25:41 - 文本文件输出.0 - 
2020/05/06 14:25:41 - 文本文件输出.0 - Unable to get VFS File object for filename 'D:/data/kettle/2020-05-06/abc_20200506.txt' : Could not find file with URI "D:\data\kettle\2020-05-06\abc_20200506.txt" because it is a relative path, and no base URI was provided.
2020/05/06 14:25:41 - 文本文件输出.0 - Could not find file with URI "D:\data\kettle\2020-05-06\abc_20200506.txt" because it is a relative path, and no base URI was provided.
2020/05/06 14:25:41 - 文本文件输出.0 - 
2020/05/06 14:25:41 - 文本文件输出.0 - Could not find file with URI "D:\data\kettle\2020-05-06\abc_20200506.txt" because it is a relative path, and no base URI was provided.
2020/05/06 14:25:41 - 文本文件输出.0 - 
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.pentaho.di.core.vfs.KettleVFS.getFileObject(KettleVFS.java:171)
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.pentaho.di.core.vfs.KettleVFS.getFileObject(KettleVFS.java:117)
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.getFileObject(TextFileOutput.java:1036)
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.initFileStreamWriter(TextFileOutput.java:156)
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.writeRowToFile(TextFileOutput.java:355)
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.writeRowTo(TextFileOutput.java:468)
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.pentaho.di.trans.steps.textfileoutput.TextFileOutput.processRow(TextFileOutput.java:461)
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
2020/05/06 14:25:41 - 文本文件输出.0 - 	at java.lang.Thread.run(Thread.java:748)
2020/05/06 14:25:41 - 文本文件输出.0 - Caused by: org.apache.commons.vfs2.FileSystemException: Could not find file with URI "D:\data\kettle\2020-05-06\abc_20200506.txt" because it is a relative path, and no base URI was provided.
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:731)
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.pentaho.di.core.vfs.ConcurrentFileSystemManager.resolveFile(ConcurrentFileSystemManager.java:91)
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:677)
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:632)
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.pentaho.di.core.vfs.KettleVFS.myGetFileObject(KettleVFS.java:177)
2020/05/06 14:25:41 - 文本文件输出.0 - 	at org.pentaho.di.core.vfs.KettleVFS.getFileObject(KettleVFS.java:167)
2020/05/06 14:25:41 - 文本文件输出.0 - 	... 8 more
2020/05/06 14:25:41 - 文本文件输出.0 - 完成处理 (I=0, O=0, R=1, W=0, U=0, E=1)
2020-05-06 14:25:41.169 [db2file - 文本文件输出] INFO  org.pentaho.di.trans.Trans - [src/main/resources/kjb/db2file1.ktr]  完成处理 (I=0, O=0, R=1, W=0, U=0, E=1)
2020/05/06 14:25:41 - 表输入.0 - Finished reading query, closing connection.
2020-05-06 14:25:41.171 [db2file - 表输入] INFO  org.pentaho.di.trans.Trans - [src/main/resources/kjb/db2file1.ktr]  Finished reading query, closing connection.
2020/05/06 14:25:41 - db2file - 转换被检测 
2020-05-06 14:25:41.174 [db2file - 文本文件输出] WARN  org.pentaho.di.trans.Trans - [src/main/resources/kjb/db2file1.ktr]  转换被检测 
2020/05/06 14:25:41 - db2file - 转换正在杀死其他步骤!
2020-05-06 14:25:41.175 [db2file - 文本文件输出] WARN  org.pentaho.di.trans.Trans - [src/main/resources/kjb/db2file1.ktr]  转换正在杀死其他步骤!
Disconnected from the target VM, address: '127.0.0.1:54021', transport: 'socket'

Process finished with exit code 0

原因:勾选了这个导致

解决:将其转为不勾选状态

体现在ktr文件中为:修改为 N 即可!

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
你可以使用Spring Boot来集成Kettle,以下是一些步骤: 1. 首先,将Kettle的依赖添加到你的Spring Boot项目中。可以在项目的pom.xml文件中添加以下依赖: ```xml <dependency> <groupId>org.pentaho</groupId> <artifactId>kettle-core</artifactId> <version>8.3.0.0-371</version> </dependency> ``` 2. 创建一个Kettle的配置类,用于初始化Kettle环境。在这个类中,你可以设置Kettle的一些配置信息,如数据库连接等。示例代码如下: ```java @Configuration public class KettleConfig { @PostConstruct public void init() throws KettleException { KettleEnvironment.init(); } // 其他配置信息 } ``` 3. 创建一个Kettle的服务类,用于执行Kettle转换或作业。在这个类中,你可以使用Kettle提供的API来加载、运行和监控转换或作业。示例代码如下: ```java @Service public class KettleService { public void runTransformation(String transformationPath) throws KettleException { // 加载转换 TransMeta transMeta = new TransMeta(transformationPath); // 创建转换 Trans trans = new Trans(transMeta); // 执行转换 trans.execute(null); // 等待转换完成 trans.waitUntilFinished(); // 获取转换执行结果 Result result = trans.getResult(); // 处理转换执行结果 // ... } public void runJob(String jobPath) throws KettleException { // 加载作业 JobMeta jobMeta = new JobMeta(jobPath, null); // 创建作业 Job job = new Job(null, jobMeta); // 执行作业 job.start(); // 等待作业完成 job.waitUntilFinished(); // 获取作业执行结果 Result result = job.getResult(); // 处理作业执行结果 // ... } } ``` 4. 在你的业务代码中,可以通过注入KettleService来使用Kettle的功能。例如: ```java @RestController public class MyController { @Autowired private KettleService kettleService; @GetMapping("/runTransformation") public String runTransformation() throws KettleException { String transformationPath = "path/to/your/transformation.ktr"; kettleService.runTransformation(transformationPath); return "Transformation executed successfully."; } @GetMapping("/runJob") public String runJob() throws KettleException { String jobPath = "path/to/your/job.kjb"; kettleService.runJob(jobPath); return "Job executed successfully."; } } ``` 以上是一个简单的示例,你可以根据你的具体需求进行相应的配置和调整。希望对你有帮助!如有其他问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值