Hi all,

I used the following code to create an applicationConfiguration for submitting 
a Flink job to a YARN cluster in application mode:

ApplicationConfiguration applicationConfiguration =
                new ApplicationConfiguration(userProgramArguments, 
userMainClass);


However, I encountered an issue when userProgramArguments contains special 
characters such as single quotation marks (') or the sequence $#. In such 
cases, Flink fails to parse the arguments correctly.

For example, when the userProgramArguments string is:

kuser='log' kpwd='log@123$#sM' groupId=group-trace-source


Flink parses it incorrectly as:

'kuser=\'log\'';'kpwd=\'log@123\$'


This leads to an exception at runtime, as shown below:

2025-07-08 20:04:01,336 WARN  org.apache.flink.configuration.Configuration      
           [] - Config uses deprecated configuration key 'web.port' instead of 
proper key 'rest.bind-port'
2025-07-08 20:04:01,343 INFO  org.apache.flink.yarn.Utils                       
           [] - Resolved keytab path: 
/data/hadoop/yarn/local2/usercache/etl_03/appcache/application_1749118442714_1372/container_e63_1749118442714_1372_02_000001/krb5.keytab
2025-07-08 20:04:01,346 INFO  
org.apache.flink.runtime.clusterframework.BootstrapTools     [] - Setting 
directories for temporary files to: 
/data/hadoop/yarn/local2/usercache/etl_03/appcache/application_1749118442714_1372
2025-07-08 20:04:01,348 ERROR 
org.apache.flink.runtime.entrypoint.ClusterEntrypoint        [] - Could not 
create application program.
java.lang.IllegalArgumentException: Could not parse value 
'kbs=fullchain01:9092,fullchain02:'kuser=\'log\'';'kpwd=\'log@123\$' for key 
'$internal.application.program-args'.
    ...
Caused by: java.lang.IllegalArgumentException: Could not split string. Quoting 
was not closed properly.
    ...


It seems that the Flink CLI modifies or escapes the input, resulting in 
malformed arguments.

Is there a recommended way to pass such userProgramArguments to the user’s main 
function without being altered by the CLI?

Thanks in advance for your help in resolving this issue.


Best regards,

leilinee

Reply via email to