You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kettle新手求助:无法向Pentaho KJB文件传递filePath参数

Hey there! Since you’ve got the filePath parameter working perfectly in Spoon, let’s get it sorted for other execution methods—here’s how to pass that parameter reliably no matter how you run your KJB:

1. Command Line Execution (Kitchen)

This is the most common way to run Kettle jobs outside the GUI. You’ll use the kitchen.sh (Linux/macOS) or kitchen.bat (Windows) tool, and pass the parameter directly with the -param: flag.

Example Commands:

  • Windows:
    Kitchen.bat /file:"C:\path\to\your\job.kjb" /param:filePath="C:\data\your_input_file.csv"
    
  • Linux/macOS:
    ./kitchen.sh -file="/home/you/path/to/job.kjb" -param:filePath="/home/you/data/your_input_file.csv"
    

Notes:

  • Wrap paths with spaces in double quotes to avoid parsing errors.
  • Run the command from the data-integration directory of your Kettle installation, or use absolute paths for both kitchen and your KJB file.
2. Running via Carte Server

If you’re using Carte to run jobs on a remote server, you can pass parameters either through the web UI or via an API call:

Web UI Method:

  1. Log into your Carte server’s web interface (typically http://your-server:8080/kettle).
  2. Navigate to Jobs > Execute a Job.
  3. Enter the path to your KJB, then scroll to the Parameters section.
  4. Add a new parameter with key filePath and your desired file path as the value, then submit the job.

API/Curl Method:

Use a POST request to submit the job with parameters:

curl -X POST "http://your-carte-server:8080/kettle/executeJob" \
  -d "job=/path/to/your/job.kjb&param:filePath=/full/path/to/input/file.csv"
3. Scheduling with Cron/Windows Task Scheduler

When scheduling your job, you just need to embed the parameter in the command you schedule:

Linux Cron Example:

Add this line to your crontab (run crontab -e to edit) to run the job daily at 2 AM:

0 2 * * * /opt/pentaho/data-integration/kitchen.sh -file="/opt/jobs/your_job.kjb" -param:filePath="/opt/data/daily_input.csv"

Windows Task Scheduler Example:

  1. Create a new task, set the trigger time.
  2. For the action, select Start a program, then browse to Kitchen.bat (usually in C:\Pentaho\data-integration\Kitchen.bat).
  3. In the Add arguments field, enter:
    /file:"C:\jobs\your_job.kjb" /param:filePath="C:\data\daily_input.csv"
    
Quick Troubleshooting Tips
  • Case Sensitivity: Kettle parameter names are case-sensitive—make sure you’re using exactly filePath (not filepath or FilePath) when passing the parameter.
  • Variable Mapping: Double-check your KJB’s "Set Variables" step: ensure it’s set to pull the value from the filePath parameter, and that the variable name matches what your KTR is expecting.
  • Log Checks: Add -level=Detailed to your command line to get verbose logs—this will show if the parameter is being picked up correctly by the job.
  • Path Formatting: On Windows, use backslashes in paths (no need to escape them if wrapped in quotes); on Linux/macOS, use forward slashes.

内容的提问来源于stack exchange,提问作者KCK

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 06:42:24