Hi Aljoscha, I found the root cause of my problem from this reference https://stackoverflow.com/questions/18151072/cant-find-resource-file-after-exporting-to-a-runnable-jar . So I changed the way to use ParameterTool. I read the configurations from InputStream, construct them as argument format and used ParameterTool.fromArgs() to parse them with other arguments. I'm not sure if this is a good solution. If you have any better one, please let me know. Thanks for your help.
Best Regards, Tony Wei 2017-09-08 23:40 GMT+08:00 Tony Wei <tony19920...@gmail.com>: > Hi Aljoscha, > > I have tried > `StreamJob.class.getClassLoader().getResource("application.conf").getPath()`, > but I got this exception. > > Caused by: java.io.FileNotFoundException: Properties file > /home/tonywei/flink/file:/tmp/flink-web-24351e69-a261-45be- > 9503-087db8155a8f/d69a3ca9-bfa0-43ef-83e8-e15f38162a87_ > quickstart-0.1.jar!/application.conf > > Best Regards, > Tony Wei > > 2017-09-08 23:24 GMT+08:00 Aljoscha Krettek <aljos...@apache.org>: > >> Hi, >> >> How are you specifying the path for the properties file? Have you tried >> reading the properties by using this.getClass().getClassLoader >> ().getResource()? >> >> Best, >> Aljoscha >> >> > On 8. Sep 2017, at 16:32, Tony Wei <tony19920...@gmail.com> wrote: >> > >> > Hi, >> > >> > I put the my configuration file in `./src/main/resources/` and packed >> it inside my jar. >> > I want to run it on standalone cluster by using web UI to submit my job. >> > No matter which way I tried, the ParameterTool.fromPropertiesFile() >> couldn't find the file path, but threw `FileNotFoundException` instead. >> > Is there any best practice to deal with such problem? Thanks for your >> help. >> > >> > Best Regards, >> > Tony Wei >> >> >