Solution 1:

After refactoring my java code and adding a code segment for debug I was able to identify the error.

See the refactoring:

StreamingQuery query = dataStreamReader.load()
        .map((MapFunction<String, StringArray>) x -> new StringArray(x),
        .map((MapFunction<StringArray, RDMessage>)
                r -> new RDMessage(r), messageEncoder)
        .map((MapFunction<RDMessage, RDMeasurement>) e ->
                e.getRdMeasurement(), measurementEncoder)
        .map((MapFunction<RDMeasurement, String>) e -> {
            if (e.getDataSourceName() != null) {
                System.out.println("•••> " + e);
            return e.toString();
        }, Encoders.STRING())
        .map((MapFunction<String, RDMeasurement>) s -> new RDMeasurement(s),

The code commented above allowed me to identify the problem.

see the error and the correction of it