3

I am new to Flink Streaming framework and I am trying to understand the components and the flow. I am trying to run the basic wordcount example using the DataStream. I am trying to run the code on my IDE. The code runs with no issues when I feed data using the collection as

    DataStream<String> text = env.fromElements(
               "To be, or not to be,--that is the question:--",
               "Whether 'tis nobler in the mind to suffer",
                "The slings and arrows of outrageous fortune",z
               "Or to take arms against a sea of troubles,"
        );

But, it fails everytime when I am trying to read data either from the socket or from a file as below:

DataStream<String> text = env.socketTextStream("localhost", 9999);
or
DataStream<String> text = env.readTextFile("sample_file.txt");

For both the socket and textfile, I am getting the following error:

Exception in thread "main" java.lang.reflect.InaccessibleObjectException: Unable to make field private final byte[] java.lang.String.value accessible: module java.base does not "opens java.lang" to unnamed module
Anirban Das
  • 61
  • 1
  • 3
  • What versions of Java and Flink are you using? – David Anderson Dec 13 '21 at 08:46
  • I suppose you probably have an issue with Java configuration on your machine. What version of Java do you use ? Maybe this could help [how-to-solve-inaccessibleobjectexception-unable-to-make-member-accessible-m](https://stackoverflow.com/questions/41265266/how-to-solve-inaccessibleobjectexception-unable-to-make-member-accessible-m) – Niko Dec 13 '21 at 08:50
  • I am using the following version of JAVA. openjdk version "17.0.1" 2021-10-19 – Anirban Das Dec 13 '21 at 16:28
  • That's why it isn't working. Flink only supports Java 8 and Java 11. – David Anderson Dec 14 '21 at 09:34

1 Answers1

4

Flink currently (as of Flink 1.14) only supports Java 8 and Java 11. Install a suitable JDK and try again.

David Anderson
  • 39,434
  • 4
  • 33
  • 60