Dear Flink Community,
I'm currently working on a simple Apache Flink project inside Docker using
version 1.15.2. The goal of the project is to read user transactions from a
text file (`input.txt`), calculate the total transaction amount per user, and
write the result as a CSV.
My code uses this line to read the input: env.readTextFile("/opt/input.txt");
However, I keep encountering the following error during execution:
Caused by: java.io.FileNotFoundException: The provided file path
/opt/input.txt does not exist.
This is what I've done so far:- I copied the input file into the container
using: `docker cp input.txt flink-jobmanager:/opt/input.txt`- I also checked
and verified that the file exists using: `docker exec flink-jobmanager ls -l
/opt/input.txt` and it shows the file correctly.- I run the job using:
`docker exec -it flink-jobmanager bash -c "./bin/flink run -c
UserTransactionSum /opt/UserTransactionSum.jar"`
Still, the job fails with the same `FileNotFoundException`.
I'm attaching a zip of my project which includes:- `UserTransactionSum.java`
(the main Java class)- `input.txt` (sample input file)- `docker-compose.yml`
(used to set up the Flink cluster)
Could someone please help me understand what I’m doing wrong? I'm stuck and
would deeply appreciate your guidance ❤️
Best regards, Faezeh Ghanbarian [email protected]
docker-compose.yml
Description: Binary data
faezeh,100 faezeh,200 ali,300 ali,400
Main-Class: UserTransactionSum
UserTransactionSum.java
Description: Binary data
