While trying to execute a basic Flink program in eclipse, I'm getting error due to .print() called by datastream_name.print() for printing my datastream.
using Java8
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 #776aec5c
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:180)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:174)
at org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:106)
at org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:132)
at org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:132)
at org.apache.flink.api.java.ClosureCleaner.clean(ClosureCleaner.java:69)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.clean(StreamExecutionEnvironment.java:2139)
at org.apache.flink.streaming.api.datastream.DataStream.clean(DataStream.java:203)
at org.apache.flink.streaming.api.datastream.DataStream.addSink(DataStream.java:1243)
at org.apache.flink.streaming.api.datastream.DataStream.writeUsingOutputFormat(DataStream.java:1144)
at org.apache.flink.streaming.api.datastream.DataStream.writeAsText(DataStream.java:1004)
at orgname.testProjectFlink.App.main(App.java:19)
What is the flink version?
Beginning from flink1.15, the support of Java 8 is now deprecated and removed (FLINK-25247). The Flink community recommends all users migrate to Java 11.
Related
My source code compiles on java 7 and runs on java 11.
I am trying to integrate imperva RASP as a java agent in tomcat. However, when I start the tomcat server, it is throwing following exception:
Caused by: java.lang.IllegalAccessError: class sun.security.ec.ECDSASignature (in module jdk.crypto.ec) cannot access class com.imperva.rasp.AgentBridge (in unnamed module #0x66c61024) because module jdk.crypto.ec does not read unnamed module #0x66c61024
at jdk.crypto.ec/sun.security.ec.ECDSASignature.<init>(ECDSASignature.java:118)
at jdk.crypto.ec/sun.security.ec.ECDSASignature.<init>(ECDSASignature.java:106)
at jdk.crypto.ec/sun.security.ec.ECDSASignature$SHA1.<init>(ECDSASignature.java:214)
at jdk.crypto.ec/sun.security.ec.SunEC$ProviderService.newInstance(SunEC.java:102)
at java.base/java.security.Signature.isSpi(Signature.java:331)
The way I am passing java agent is:
JAVA_OPTS="-javaagent:$IMPERVA_JAR $JAVA_OPTS"
I went through multiple posts such as this one about --add-opens argument. Based on that, I am passing JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=jdk.crypto.ec/sun.security.ec=ALL-UNNAMED"
I can see following statement in the logs:
Picked up JDK_JAVA_OPTIONS: --add-opens=jdk.crypto.ec/sun.security.ec=ALL-UNNAMED
Am I missing something here or is there any syntax error in the arguments that I am passing?
There is no any other configuration is done.
Any help is appreciated. Thank you.
Managed to solve it by using --add-reads instead of --add-opens.
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-reads jdk.crypto.ec=ALL-UNNAMED"
Existing code is working perfectly fine with JDK11 installed. Same lines of code is throwing below error in JDK16
java.lang.reflect.InaccessibleObjectException: Unable to make private static native long[] java.util.prefs.WindowsPreferences.WindowsRegOpenKey(long,byte[],int) accessible: module java.prefs does not "opens java.util.prefs" to unnamed module #3f803fae
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
When code is migrated from Java8 to Java9, WinRegistry.java file is modified with some of the methods' input parameter(s) type from int to long
Reading/Writing from/to Windows Registry is much simpler with Advapi32Util.java
With this JNA APIs one can easily read the Registry Keys, Values and also can set Registry with new key and value.
I used following APIs to fetch Registry value of a key with path to the registry key as below
Advapi32Util.registryGetStringValue(WinReg.HKEY_LOCAL_MACHINE, registry_path, value_of)
Also, the children key(s) under specific path can be fetched from below API
Advapi32Util.registryGetKeys(HKEY root, String keyPath)
So, ever since I updated my repository from my group, I got this error, however, when I looked at the commits all that changes in the built-in files are the version of gradle and jdk. I've searched and done possible solution regarding the app:processDebugMainMAnifest and I just don't know how I can resolve this problem.
Execution failed for task ':app:processDebugMainManifest'.
Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module #645de77a
I wanted to just run HelloWorld on Intellij Idea which is failed.
Java Version is "9-ea" in my macOS.
Error:Internal error: (java.lang.IllegalAccessError) class com.intellij.util.io.FileChannelUtil (in unnamed module #0x6ecc4cd7) cannot access class sun.nio.ch.FileChannelImpl (in module java.base) because module java.base does not export sun.nio.ch to unnamed module #0x6ecc4cd7
java.lang.IllegalAccessError: class com.intellij.util.io.FileChannelUtil (in unnamed module #0x6ecc4cd7) cannot access class sun.nio.ch.FileChannelImpl (in module java.base) because module java.base does not export sun.nio.ch to unnamed module #0x6ecc4cd7
at com.intellij.util.io.FileChannelUtil.setupUnInterruptibleHandle(FileChannelUtil.java:26)
......
Please make sure to use the release JDK version, not ea and update to the latest IntelliJ IDEA version.
I had the same error and the solution I've found was to downgrade my Java version (JDK) from 16 to 11. Then, it worked :)
I am trying to access JavaFX's package-private class & public static method in it (javafx.scene.control.skin.TableSkinUtils.resizeColumnToFitContent), so that I can resize TableView's columns automatically.
However, I'm using the module system since it seems that JavaFX 11 requires my app to be a module. If I don't specify a module for my app, I get this error: Error: JavaFX runtime components are missing, and are required to run this application I'd actually prefer to not use the module system at all, is there a way?
Now, due to the module system, I get an exception when attempting to make the method TableSkinUtils.resizeColumnToFitContent accessible:
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make public static void javafx.scene.control.skin.TableSkinUtils.resizeColumnToFitContent(javafx.scene.control.skin.TableViewSkinBase,javafx.scene.control.TableColumnBase,int) accessible: module javafx.controls does not "opens javafx.scene.control.skin" to module Explorer
So, I tried to add this workaround: --add-opens javafx.controls/javafx.scene.control.skin=ALL-UNNAMED to Intellij's run configuration VM options.
However, with or without the above, I get the same exception.
What am I possibly doing wrong?