Dear Team, After changing the code to the below, error got resolved
Map<String, Double> rules = alerts.entrySet().stream() .collect(Collectors.toMap(e -> (String) e.getKey(), e -> Double.parseDouble ((String)e.getValue()))); Thanks, Tauseef On Tue, 5 Dec 2023 at 14:00, Tauseef Janvekar <tauseefjanve...@gmail.com> wrote: > Dear Team, > > I am getting cast exception in flink. > Caused by: org.apache.flink.client.program.ProgramInvocationException: The > main method caused an error: class java.lang.String cannot be cast to class > java.lang.Double (java.lang.String and java.lang.Double are in module > java.base of loader 'bootstrap') at > org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:372) > > The code that I wrote is > > Properties alerts = new Properties(); > > try (InputStream stream = OtelTransformerJob.class > .getClassLoader().getResourceAsStream("rule-based-config.txt")) { > > alerts.load(stream); > > } > > Map<String, Double> rules = alerts.entrySet().stream() > > .collect(Collectors.toMap(e -> (String) e.getKey(), e -> (Double) e > .getValue())); > > > Not sure what is the problem here > > Thanks, > Tauseef >