JAVA 11: "illegal reflective access" warning

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

JAVA 11: "illegal reflective access" warning

blueencoder
This post was updated on .
Hi,

at application run-time, when calling Platform.getOSAndArch() with a JAVA11 RTE (Oracle, OpenJDK) a warning is printed through StdErr:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3 (file:/C:/Users/.../gluegen-rt.jar) to method java.lang.ClassLoader.findLibrary(java.lang.String)
WARNING: Please consider reporting this to the maintainers of com.jogamp.common.os.NativeLibrary$3
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release


I am using gluegen v2.3.2 (commit cc1e9bc).
My application runs under Windows 7 / 10.
Everything is still working with JAVA 11, but I am afraid that with a not too far in the future release of JAVA gluegen might fail to run properly.
Because the last release of gluegen was in 2015, I wonder if it is still worked on...

Greetings,
Markus

Stacktrace:
WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3 (file:/.../gluegen-rt.jar) to method java.lang.ClassLoader.findLibrary(java.lang.String)
        at com.jogamp.common.os.NativeLibrary$3.run(NativeLibrary.java:603)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at com.jogamp.common.os.NativeLibrary.findLibraryImpl(NativeLibrary.java:597)
        at com.jogamp.common.os.NativeLibrary.findLibrary(NativeLibrary.java:642)
        at com.jogamp.common.os.NativeLibrary.enumerateLibraryPaths(NativeLibrary.java:431)
        at com.jogamp.common.os.NativeLibrary.enumerateLibraryPaths(NativeLibrary.java:390)
        at jogamp.common.os.PlatformPropsImpl.findSysLib(PlatformPropsImpl.java:449)
        at jogamp.common.os.PlatformPropsImpl.queryElfFile(PlatformPropsImpl.java:404)
        at jogamp.common.os.PlatformPropsImpl.access$000(PlatformPropsImpl.java:38)
        at jogamp.common.os.PlatformPropsImpl$1.run(PlatformPropsImpl.java:165)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at jogamp.common.os.PlatformPropsImpl.<clinit>(PlatformPropsImpl.java:160)
        at xxx.XXX.main(XXX.java:160)
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

Sven Gothel
Administrator
Thank you Markus,

surely worth a bug report entry, to be fixed.

Cheers,

~Sven

On 12/20/18 1:29 PM, blueencoder [via jogamp] wrote:

> Hi,
>
> at application run-time, when calling Platform.getOSAndArch() with a JAVA11
> RTE (Oracle, OpenJDK) a warning is printed through StdErr:
>
> /WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3
> (file:/C:/Users/.../gluegen-rt.jar) to method
> java.lang.ClassLoader.findLibrary(java.lang.String)
> WARNING: Please consider reporting this to the maintainers of
> com.jogamp.common.os.NativeLibrary$3
> WARNING: Use --illegal-access=warn to enable warnings of further illegal
> reflective access operations
> WARNING: *All illegal access operations will be denied in a future release*/
>
> I am using gluegen v2.3.2 (commit cc1e9bc).
> My application runs under Windows 7 / 10.
> Everything is still working with JAVA 11, but I am afraid that with a not too
> far in the future release of JAVA gluegen might fail to run properly.
> Because the last release of gluegen was in 2015, I wonder if it is still
> worked on...
>
> Greetings,
> Markus
>
> ------------------------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

gouessej
Administrator
It's mentioned in this bug report:
https://jogamp.org/bugzilla/show_bug.cgi?id=1317
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

Wade Walker
Administrator
In reply to this post by blueencoder
I'm working on trying to compile gluegen/jogl/jocl with Java 11. If that works, I was planning to look at this bug, since I've been seeing it too in my own application.
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

SteveV
I upgraded from a Windows 7 to a Windows 10 machine and from the old 1.6.0 (with javax.* package names) to Java3d 1.7.0.  When I build and run my app, I get

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3 (file:/C:/Program%20Files/Java/jogamp-2.3.2/gluegen.jar) to method java.lang.ClassLoader.findLibrary(java.lang.String)
WARNING: Please consider reporting this to the maintainers of com.jogamp.common.os.NativeLibrary$3
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

My app loads and does not crash, but the behavior is very erratic, long pauses, ignoring mouse inputs, etc.  Might this behavior result from this warning?  How do I know if it is using the proper OS services and drivers?
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

gouessej
Administrator
Use the latest release candidate of JOGL 2.4 and if these problems persist, fill a bug report.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

SteveV
I have an Intel HD Graphics 4000 chip, but I see jogamp chooses the jogl-all-android-natives-windows-amd64 rather than the jogl-all-android-natives-windows-i586 jar library.  Is that expected with an Intel graphics chip?  Is there some test I can download to see if the basic libraries and deployment are working on my machine?
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

Sailsman63
The bit-ness of the selected library is entirely based on the core system architecture (and whether you are running a 32 bit jvm) as long as your system has the correct hardware driver for your card, jogamp shouldn't care what the card is.
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

gouessej
Administrator
In reply to this post by SteveV
Please follow the instructions given in the wiki and in my tutorial, you just have to use the JogAmp fat jar:
http://gouessej.wordpress.com/2012/08/01/java-3d-est-de-retour-java-3d-is-back/
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

SteveV
I followed the instructions on your wiki.  I noticed your site pointed to java3d 1.7.0-pre1, which is slightly different than what I had earlier downloaded.   I am still having the same problem, although this time it seems to be extremely slow but less likely to hang completely.  I also get an actual error message, below.  

I am using this with swing, Canvas3D as a heavy-weight AWT component.  I know this is sometimes not recommended, but it worked fine on an earlier Windows 7 and two even more ancient Windows Vista machines.  JCanvas3D, which was a work-in-progress, used to not work.

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jogamp.java3d.JoglPipeline (file:/C:/Users/stevevestal/Documents/SolidSystems/solidwork/java3d-1.7/j3dcore.jar) to method sun.awt.AppContext.getAppContext()
WARNING: Please consider reporting this to the maintainers of org.jogamp.java3d.JoglPipeline
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
com.jogamp.opengl.GLException: Error swapping buffers
        at jogamp.opengl.windows.wgl.WindowsWGLDrawable.swapBuffersImpl(WindowsWGLDrawable.java:93)
        at jogamp.opengl.GLDrawableImpl.swapBuffers(GLDrawableImpl.java:88)
        at org.jogamp.java3d.JoglPipeline.swapBuffers(JoglPipeline.java:6787)
        at org.jogamp.java3d.Canvas3D.swapBuffers(Canvas3D.java:4631)
        at org.jogamp.java3d.Renderer.doWork(Renderer.java:267)
        at org.jogamp.java3d.J3dThread.run(J3dThread.java:271)
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

gouessej
Administrator
Yes, you're right, that's why I complained about the inconsistent layout of files between Java3D 1.6 and Java3D 1.7 :(

Please provide a SSCCE. If we can't reproduce the problem, we won't be able to help you. Provide the full stack trace. Please use JOGL 2.4 instead of JOGL 2.3.2.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

SteveV
Your web pointed to http://jogamp.org/deployment/jogamp-current/archive/jogamp-fat-all.7z
I downloaded https://jogamp.org/deployment/v2.4.0-rc-20200202/fat/jogamp-fat-all.7z
That gave the same result, many seconds to do a small rotation of a simple block shape, often hanging and doing nothing.

Is there a downloadable SSCCE on the jogamp site somewhere?  Just a very basic, create a shape and do pan, zoom, and rotate gestures?  A very basic demo of any sort?
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

gouessej
Administrator
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

Sven Gothel
Administrator
In reply to this post by SteveV
On 3/4/20 12:14 PM, SteveV [via jogamp] wrote:
> Your web pointed to
> http://jogamp.org/deployment/jogamp-current/archive/jogamp-fat-all.7z
> I downloaded
> https://jogamp.org/deployment/v2.4.0-rc-20200202/fat/jogamp-fat-all.7z

FYI, current symbolic links are:

jogamp-current -> v2.3.2
jogamp-next -> v2.4.0-rc-20200202

~Sven
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

SteveV
I tried the rudimentary standalone test for com.jogamp.opengl.  That appears to work.

I switched to v2.3.2 of jogamp-fat-all, keeping Java3d 1.7.  For a half-second, I was able to rotate a shape with normal performance before it went back to extreme pausing with occasional blanking of the canvas for many seconds.  There are no exceptions or stack dumps.  Now I get a different warning,

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jogamp.java3d.JoglPipeline (file:/C:/Users/steveVl/Documents/SolidSystems/solidwork/java3d-1.7/j3dcore.jar) to method sun.awt.AppContext.getAppContext()
WARNING: Please consider reporting this to the maintainers of org.jogamp.java3d.JoglPipeline
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release  

I tried the version of java I was using earlier, 1.8.0_241, and although the performance hang-up still existed, I did not get the above warning.

I checked my device drivers, they are all up-to-date.  Is there any additional configuration needed on Windows 10 other than having the java, java3d, and jogamp libraries installed and on the build path (specified in Eclipse as given on the web page)?

I could not find any online guidance or example of JCanvas3D (which had not worked a few years ago when I did the Windows 7 testing), but I tried switching anyway and consistently get the following.  Is it worth trying JCanvas3D, and are there any examples or guidelines for setting this up?

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at solidmake.views.MainCanvas.setCursor(MainCanvas.java:191)
        at solidmake.views.MainButtons$13.actionPerformed(MainButtons.java:305)
        at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
        at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
        at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
        at java.desktop/javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:401)
        at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
        at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
        at java.desktop/java.awt.Component.processMouseEvent(Component.java:6636)
        at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
        at java.desktop/java.awt.Component.processEvent(Component.java:6401)
        at java.desktop/java.awt.Container.processEvent(Container.java:2263)
        at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5012)
        at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
        at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844)
        at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
        at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
        at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
        at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
        at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2762)
        at java.desktop/java.awt.Component.dispatchEvent(Component.java:4844)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
        at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
        at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

gouessej
Administrator
You don't provide enough information on your hardware and you can still have an up-to-date but broken driver but as the rudimentary example seems to work, maybe the culprit is in Java3D. Do you use a laptop? What's your GPU? Intel? Please provide a SSCCE. Which variable is null?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

Sailsman63
In reply to this post by SteveV
>switched to v2.3.2 of jogamp-fat-all,

Which is still the old jogl version, so your

>WARNING: An illegal reflective access operation has occurred
>WARNING: Illegal reflective access by org.jogamp.java3d.JoglPipeline (file:/C:/Users/steveVl/Documents/SolidSystems/solidwork/java3d-1.7/j3dcore.jar) to method sun.awt.AppContext.getAppContext()

Is *expected*. You need to update to the 2.4.0 rc to get rid of that. (Oracle and the OpenJDK project have been working to remove access to many of these sun.*.* Packages since Java 9 - they were never officially supported, and they want to be able to remove or change them in breaking ways - which is also why you don't get the warning on Java 8. - at that point, they didn't care)

As someone who has worked through some of this transition with another application:

- update to the latest library
- recompile your application against the new library, using the oldest version of Java that you want to support

There seem to be a few places where the Fully Qualified Classname/Method name that the compiler generated when compiling against the old library causes issues when run against the new. (Weird exceptions, etc)
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

SteveV
I went back to the versions I tried before when upgrading to a Windows 10 box, which are
jogamp-java3d-1.7.0-final 2020-01-25
jogamp-fat-all-2.4.0 rc 20200202

I also went back to the versions that were working on the old Windows 7 box, which were
jogamp 2.3.2
java3d 1.6.0

Neither of these configurations works on the Windows 10 box (both were Dells).  Same symptoms, extremely slow, as if there is some sort of busy wait or contention going on.  The fact that the exact set of libraries (including the same Java jre) that work on the Windows 7 box don't work on the Windows 10 box suggests it is something about the Windows 10 Dell with Intel HD Graphics 4000.  The fact that the simple com.jogamp.opengl test does work suggests it's at a higher level than that.

Can anyone point to online javadoc for JCanvas3D or an example of its use?  I am using this with swing, maybe that might make a difference.

Any other suggestions for things to try are appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

gouessej
Administrator
SteveV wrote
Windows 10 Dell with Intel HD Graphics 4000
This is the culprit. We had tons of problems with this crap:
http://forum.jogamp.org/Java3D-crash-intel-4000-tp4029426p4029462.html

Sorry, I just hope that you have access to another computer.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: JAVA 11: "illegal reflective access" warning

SteveV
Yes!  Thank you.  I went to the Dell site, downloaded and installed their driver for this hardware, and that fixed the problem.