Illegal reflective access with jogamp-java3d1.7.0-final

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

Illegal reflective access with jogamp-java3d1.7.0-final

RickLutowski
Have ported some old java3d programs to java3d1.7. They compile ok, but running them gives

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3 (file:/usr/local/_jreality/jogamp-fat.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
Inconsistency detected by ld.so: dl-lookup.c: 111: check_match: Assertion `version->filename == NULL || ! _dl_name_match_p (version->filename, map)' failed!


Another post from Nov 2022 encountered a similar problem with java3d1.7.0-pre, but the problem was said to have been solved by java3d1.7.0-final.  Except I'm getting what appears to be a slightly different variant of it with -final, this time on linux Mint rather than ms windows.

While these are warnings, they are fatal enough to keep the gui from appearing. This differs from the Nov case when something was drawn on the screen.


My java version is

openjdk version "11.0.18" 2023-01-17
OpenJDK Runtime Environment (build 11.0.18+10-post-Ubuntu-0ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.18+10-post-Ubuntu-0ubuntu118.04.1, mixed mode, sharing)


My system classpath is

echo $CLASSPATH
.:/usr/local/_jreality:/usr/local/_jreality/vecmath.jar:/usr/local/_jreality/j3dcore.jar:/usr/local/_jreality/j3dutils.jar:/usr/local/_jreality/jogamp-fat.jar:/usr/local/_jreality/jogl-all-natives-linux-amd64.jar:/usr/local/java/lib/tools.jar:/usr/local/java/lib:/usr/local/java/bin:/usr/local/java:/usr/local/_oa/_oaapps:/usr/local/bin

Get the same error when running with the java command

java -cp /usr/local/_jreality:/usr/local/_jreality/j3dcore.jar:/usr/local/_jreality/jogamp-fat.jar:/usr/local/_jreality/vecmath.jar   <program name>


Let me know what other info I can provide that would be helpful.
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

gouessej
Administrator
Hello

Have you followed the advises of my tutorial? Some warnings will remain. Ensure that you use jogamp-fat.jar from JOGL 2.4.0. You probably forgot "--add-opens".

"Inconsistency detected" occurs on the OpenJDK builds of some distributions, rather use Temurin (AdoptOpenJDK) which is what I do at home under Mageia 8 and Debian Bookworm.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

RickLutowski
gouesse,

Yes, followed the tutorial with respect to installing jogamp- java3d1.7.0, jogamp-fat-all, and jogamp-all-platforms.  (Not sure if 'all-platforms' is really needed as removing it from the classpath seems to make no difference.)  After changing the old javax imports in my application to org.jogamp the programs all compiled ok.

You are right, I did not notice the part about placing  '–add-opens=java.desktop/sun.awt=ALL-UNNAMED' in the java execution statement.  Here is my java statement after doing so

java –add-opens=java.desktop/sun.awt=ALL-UNNAMED -cp /usr/local/_jreality:/usr/local/_jreality/j3dcore.jar:/usr/local/_jreality/jogamp-fat.jar:/usr/local/_jreality/vecmath.jar  <main_classname>

and the result:

Error: Could not find or load main class –add-opens=java.desktop.sun.awt=ALL-UNNAMED
Caused by: java.lang.ClassNotFoundException: –add-opens=java.desktop.sun.awt=ALL-UNNAMED


Tried reading about the '–add-opens=' option, but it is not mentioned in either the java man page or the 'java-h' output for my OpenJDK11 installation on Mint linux, so I have no idea what this option does, or the correct way to use it.  The tutorial says "replace ALL-UNNAMED by the name of your module if it exists".  I do not know what "your module" refers to.  Maybe '–add-opens=' is a special switch in the Temurin (AdoptOpenJDK) you mentioned in your response?

Other than lacking an explanation of '–add-opens=', the tutorial is very helpful.  Especially like the Introduction, which gives some history of java3d starting around 2008, which is after I got away from it around 2004.  (In anyone is interested, I know some of its history up to 2004).

Please clarify the '–add-opens=' option, and how I am apparently misusing it.
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

gouessej
Administrator
This post was updated on .
Sorry, there is something wrong on my blog, it seems to replace -- by another character. Wordpress sucks sometimes:
https://bytexd.com/prevent-wordpress-from-converting-double-hyphen-into-dash/

It should be fixed now. Thank you so much for the valuable feedback.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

RickLutowski
gouesse,

Placing '--' (double dash) before the 'add-opens' eliminates the "Could not find or load main class" error.  Now it is back to the original 'reflective access' error.  Since '--add-opens' appears to solve the problem, yet does not appear in my OpenJDK11 docs, this option must have been added after JDK11.  The latest LTS is Java17, which would imply that Java17 is the earliest LTS required to run java3d applications, at least on some systems.

This is important info to know.  Unfortunately, it also puts some of us java3d developers in a bit of a quandary.

I recall seeing a post from a developer who wanted to continue using java3d with Java8.  He was advised to upgrade to Java11 (now I guess it might be Java17) not just to get java3d to work, but also other reasons like bug fixes, security fixes, etc.  While these are valid considerations, it is desirable for programs that target a general audience to work on as wide a range of Java installations as possible.  A program that requires a version of the JRE later than the one installed on the potential user's system will likely not get used because most users do not know how to upgrade their JRE, nor can they be expected to take the time and effort to learn. This is why I have taken great care to ensure that CM Creator does not require anything later than Java 8. Similarly, CM Surveyor used to work with Java 1.4 (circa 2004) until I just upgraded it to java3d1.7-final -- and now it suddenly requires Java17!!  Merging CM Surveyor's java3d code into CM Creator to enable hidden line display would then make CM Creator require Java17 instead of just Java8.  It's tough enough to get potential users to try a new program like CM Creator without requiring them to make significant changes to their computer configuration as well!

This entire quandary seems to be rooted in the "illegal reflective access" problem which, based on the posts, goes back at least to java3d1.7-pre.  

Java allows us do some neat things, but that doesn't mean we _should_ do them. Topping this list is sharing data among multiple threads. It is possible to get a performance increase (depending on the hardware) if it's done right, but a debugging and maintenance nightmare results from doing it wrong, and it's easy to do wrong. I would put reflection just under shared data as something to avoid if possible.

How hard would it be to avoid using reflection in java3D?
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

gouessej
Administrator
--add-opens has existed since Java 9:
https://docs.oracle.com/javase/9/migrate/toc.htm

Which documentation are you talking about? The man(ual) mentions the module path in Java 11 but it might not mention some options related to Jigsaw. Java3D can work with Java 11.

Bundling a JRE with a Java program is possible and not very difficult, time has changed, most systems don't have Java installed anyway, relying on the JRE installed on the system isn't a very good idea nowadays, most end users don't even know what a JRE is. If you really want to take care of your audience, don't give it a simple JAR, don't require a JRE installed on the system, use the technical solution that allows your end users to run your software very easily. For example, Eclipse Theia is packaged as an AppImage, Gephi is packaged as a kind of executable for some platforms, you can even create a DEB and/or RPM package.
You can use various tool to do that, including jpackage with jlink, PackR (not actively maintained?) or some other tools including mine. Please note that this solution would help your end users not to have to deal with the JRE by themselves.

Avoiding using reflection in Java3D isn't doable but on the long term, some efforts can be done to improve the modularization of the APIs managed by the JogAmp community to get rid of the nasty warnings cleanly and with correctness, without introducing dirty kludges.

To be honest, yes there are security considerations, we need to benefit of some fixes too. Supporting pre-Java 9 and post-Java 9 JREs at the same time is at least challenging or even nearly impossible in some cases, totally impossible without reflection. I don't encourage maintainers to support Java 8, it requires too much work, we're a small community. Some internal classes have been moved or removed in Java, the behavior of AWT and Swing has subtly changed in some areas including HiDPI. Trying to make Java3D 1.7 work with obsolete versions of Java is the dead end.

I know that my suggestion requires some work on your side but it will require less effort for your end users, isn't it what you want?

By the way, I plan to support AppImage in JNDT in the next months. If you succeed in creating a single fat JAR, it will be a suitable input for the solutions I mentioned earlier.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

gouessej
Administrator
In reply to this post by RickLutowski
As a reminder, Java 21 is the next LTS version of Java, it will be released in September 2023.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

gouessej
Administrator
In reply to this post by RickLutowski
Please can you try to use "--add-opens java.base/java.lang=ALL-UNNAMED" too?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

gouessej
Administrator
In reply to this post by RickLutowski
I have succeeded in reproducing your problem with OpenJDK 11.0.18. I'm currently investigating.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

gouessej
Administrator
It works with Java 11:
~/Documents/install/jdk-11.0.18+10/bin/java --add-opens java.desktop/sun.awt=ALL-UNNAMED -cp bin:j3dcore.jar:j3dutils.jar:vecmath.jar:jogamp-fat.jar fr.PyramidExample

In some situations, you have to omit the first equal sign and in some others, you must use it:
-add-opens java.desktop/sun.awt=ALL-UNNAMED
or
-add-opens=java.desktop/sun.awt=ALL-UNNAMED

Thank you for the valuable feedback again.

P.S : Java3D 1.7 is compiled with Java 1.8.0 update 25 according to the manifest.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

RickLutowski
In reply to this post by gouessej
gouesse wrote:
> Please can you try to use "--add-opens java.base/java.lang=ALL-UNNAMED" too?

$ java --add-opens java.base/java.lang=ALL-UNNAMED -cp /usr/local/_jreality:/usr/local/_jreality/j3dcore.jar:/usr/local/_jreality/jogamp-fat.jar:/usr/local/_jreality/vecmath.jar  <main_classname>

Inconsistency detected by ld.so: dl-lookup.c: 111: check_match: Assertion `version->filename == NULL || ! _dl_name_match_p (version->filename, map)' failed!


Also, adding the "=" in --add-opens

$ java --add-opens=java.base/java.lang=ALL-UNNAMED -cp /usr/local/_jreality:/usr/local/_jreality/j3dcore.jar:/usr/local/_jreality/jogamp-fat.jar:/usr/local/_jreality/vecmath.jar  <main_classname>

Inconsistency detected by ld.so: dl-lookup.c: 111: check_match: Assertion `version->filename == NULL || ! _dl_name_match_p (version->filename, map)' failed!
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

RickLutowski
In reply to this post by gouessej
gouesse wrote:
> In some situations, you have to omit the first equal sign and in some others, you must use it:
> -add-opens java.desktop/sun.awt=ALL-UNNAMED
> or
> -add-opens=java.desktop/sun.awt=ALL-UNNAMED

1. Omitting the = sign after --add-opens gives:

$ java --add-opens java.desktop/sun.awt=ALL-UNNAMED -cp /usr/local/_jreality:/usr/local/_jreality/j3dcore.jar:/usr/local/_jreality/j3dutils.jar:/usr/local/_jreality/vecmath.jar:/usr/local/_jreality/jogamp-fat.jar <main_classname>

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3 (file:/usr/local/_jreality/jogamp-fat.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
Inconsistency detected by ld.so: dl-lookup.c: 111: check_match: Assertion `version->filename == NULL || ! _dl_name_match_p (version->filename, map)' failed!


2. Including the = sign after --add-opens= gives:

$ java --add-opens=java.desktop/sun.awt=ALL-UNNAMED -cp /usr/local/_jreality:/usr/local/_jreality/j3dcore.jar:/usr/local/_jreality/j3dutils.jar:/usr/local/_jreality/vecmath.jar:/usr/local/_jreality/jogamp-fat.jar
<main_classname>

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3 (file:/usr/local/_jreality/jogamp-fat.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
Inconsistency detected by ld.so: dl-lookup.c: 111: check_match: Assertion `version->filename == NULL || ! _dl_name_match_p (version->filename, map)' failed!

3. $ java -version
openjdk version "11.0.18" 2023-01-17
OpenJDK Runtime Environment (build 11.0.18+10-post-Ubuntu-0ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.18+10-post-Ubuntu-0ubuntu118.04.1, mixed mode, sharing)


4. The above two examples differ from those in my previous posts in that I ordered to java3d jars in the -cp exactly as you had them in one of your previous posts, including adding j3dutils.jar just in case that made any difference even though my program doesn't use it.  The ordering made no difference.  (I know it shouldn't, but ...)

This is proving to be a pernicious problem, at least on my system.

More observations and comments on my next post.  At this time I just want to say I very much appreciate the attention you are giving to this problem.  If anyone volunteers to try out CM Creator (github.com/rlutowski/CMCreator) and runs into any problems, I will strive to be as responsive to them as you are to me.
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

gouessej
Administrator
As I said, "Inconsistency detected " comes from some OpenJDK builds on some GNU Linux distributions. The only solution I know consists in using another OpenJDK build. You can look for posts about this problem on the forum, I had to do that in the past. Why not trying with Adoptium?
https://adoptium.net

You have to use several --add-opens clauses to get rid of the warnings:
--add-opens java.desktop/sun.awt=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED

Please don't put the equal sign between --add-opens and the JDK module name, it seems to be necessary only when you want to pass two consecutive JVM arguments as a single one in some IDE settings, with some build tools (Gradle, etc), when you run a JVM programmatically in a C program but not when you call directly java in command line, which is your case right now. Removing this equal sign helped in my case when trying to reproduce your problem with Java 11.

You can guess how to build other necessary --add-opens clause(s) with this rule:
--add-opens <module-name>/<package-name>=<module-name> where ALL-UNNAMED designates all unnamed modules as its name implies.

Sorry, it's one o'clock in France and I work tomorrow. I'm falling asleep.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

RickLutowski
In reply to this post by gouessej
gouesse wrote:
> --add-opens has existed since Java 9:
> https://docs.oracle.com/javase/9/migrate/toc.htm

Good reference.  Found the section that describes --add-opens, and now know it is involved with deep reflection.  Was unaware of --add-opens, probably because my programs have never needed deep reflection.  Thanks for the link.

> Bundling a JRE with a Java program is possible and not very difficult, time has changed, most systems
> don't have Java installed anyway, relying on the JRE installed on the system isn't a very good idea
> nowadays, most end users don't even know what a JRE is. If you really want to take care of your
> audience, don't give it a simple JAR, don't require a JRE installed on the system, use the technical
> solution that allows your end users to run your software very easily. For example, Eclipse Theia is
> packaged as an AppImage, Gephi is packaged as a kind of executable for some platforms, ...

While I always expected to include the java3d jars with CM Creator after implementing VR capability, it never occurred to me to include the latest JRE, perhaps because I didn't realize most OEMs have stopped including it (which implies Java is not being used to implement many popular applications, but will avoid all the rabbit holes that opens and stay on topic.)  Including the latest JRE _would_ solve a lot of problems including, presumably, the "Illegal reflective access" problem. Also, doing so is permitted by Oracle:
(https://www.oracle.com/downloads/licenses/no-fee-license.html).
One downside is that the CM Creator 4MB distro would swell to almost 200MB, including java3d, but large downloads aren't as big of a concern as they used to be.  Thanks for the idea.  I'll look into it.
 

> ... you can even
> create a DEB and/or RPM package.
> You can use various tool to do that, including jpackage with jlink, PackR (not actively maintained?) or
> some other tools including mine. Please note that this solution would help your end users not to have to
> deal with the JRE by themselves.

Have always wondered how to create a linux distro like a deb. Checked your link (https://jogamp.org/wiki/index.php/Foreign_Packaging), and JNDT looks very promising for this. With so much work to do on CM Creator, don't know if I'll ever get around to creating deb or rpm for CM Creator but, if I do, JNDT will be where I'll start (still could use one or two CM Creator volunteers!)  Looks like you and the jogamp team are doing lots of good things besides supporting java3d. Thanks for all your efforts, and for the link to the distro tools.

Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

RickLutowski
In reply to this post by gouessej
gouesse wrote:
> You have to use several --add-opens clauses to get rid of the warnings:
> --add-opens java.desktop/sun.awt=ALL-UNNAMED
> --add-opens java.base/java.lang=ALL-UNNAMED

With both specified, still get:
Inconsistency detected by ld.so: dl-lookup.c: 111: check_match: Assertion `version->filename == NULL || ! _dl_name_match_p (version->filename, map)' failed!

Looks like it's time to try a different JDK version.

The Temurin distros at adoptium.net look useful for JDKs on architectures maybe not available at oracle.
Will try installing the latest Oracle JDK17 and see if that fixes it.
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

RickLutowski
In reply to this post by gouessej
1. Installed JDK17:

$ java -version
java version "17.0.6" 2023-01-17 LTS
Java(TM) SE Runtime Environment (build 17.0.6+9-LTS-190)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.6+9-LTS-190, mixed mode, sharing)


2. Ran a couple of java3d programs using:

java --add-opens java.desktop/sun.awt=ALL-UNNAMED \
--add-opens java.base/java.lang=ALL-UNNAMED \
-cp /usr/local/_jreality:\
/usr/local/_jreality/j3dcore.jar:\
/usr/local/_jreality/j3dutils.jar:\
/usr/local/_jreality/vecmath.jar:\
/usr/local/_jreality/jogamp-fat.jar \
<main_classname>


3. The good news:

"Illegal reflective access" is gone.

4. The bad news:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/jogamp_0000/file_cache/jln5582542516104284874/jln3715176253332323696/natives/linux-amd64/libnativewindow_awt.so: /usr/lib/jvm/jdk-17.0.6/lib/libjawt.so: version `SUNWprivate_1.1' not found (required by /tmp/jogamp_0000/file_cache/jln5582542516104284874/jln3715176253332323696/natives/linux-amd64/libnativewindow_awt.so)
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
        at java.base/java.lang.Runtime.load0(Runtime.java:755)
        at java.base/java.lang.System.load(System.java:1953)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:603)
        at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:63)
        at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:106)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:487)
        at jogamp.nativewindow.NWJNILibLoader.access$000(NWJNILibLoader.java:39)
        at jogamp.nativewindow.NWJNILibLoader$1.run(NWJNILibLoader.java:49)
        at jogamp.nativewindow.NWJNILibLoader$1.run(NWJNILibLoader.java:41)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at jogamp.nativewindow.NWJNILibLoader.loadNativeWindow(NWJNILibLoader.java:41)
        at jogamp.nativewindow.jawt.JAWTUtil.<clinit>(JAWTUtil.java:336)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:467)
        at com.jogamp.nativewindow.NativeWindowFactory$3.run(NativeWindowFactory.java:344)
        at com.jogamp.nativewindow.NativeWindowFactory$3.run(NativeWindowFactory.java:340)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at com.jogamp.nativewindow.NativeWindowFactory.initSingleton(NativeWindowFactory.java:340)
        at com.jogamp.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1721)
        at com.jogamp.opengl.GLProfile.access$000(GLProfile.java:80)
        at com.jogamp.opengl.GLProfile$1.run(GLProfile.java:230)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
        at com.jogamp.opengl.GLProfile.initSingleton(GLProfile.java:216)
        at com.jogamp.opengl.GLProfile.getProfileMap(GLProfile.java:2297)
        at com.jogamp.opengl.GLProfile.get(GLProfile.java:1021)
        at com.jogamp.opengl.GLProfile.get(GLProfile.java:1050)
        at com.jogamp.opengl.GLProfile.getMaxFixedFunc(GLProfile.java:803)
        at org.jogamp.java3d.JoglPipeline.initialize(JoglPipeline.java:143)
        at org.jogamp.java3d.Pipeline.createPipeline(Pipeline.java:101)
        at org.jogamp.java3d.MasterControl.loadLibraries(MasterControl.java:893)
        at org.jogamp.java3d.VirtualUniverse.<clinit>(VirtualUniverse.java:266)
        at org.jogamp.java3d.GraphicsConfigTemplate3D.getBestConfiguration(GraphicsConfigTemplate3D.java:317)
        at java.desktop/java.awt.GraphicsDevice.getBestConfiguration(GraphicsDevice.java:205)
        at com.jreality.surveyor.gui.Surveyor.<init>(Surveyor.java:390)
        at com.jreality.surveyor.gui.Surveyor.<init>(Surveyor.java:322)
        at com.jreality.surveyor.gui.Surveyor.main(Surveyor.java:1676)


I guess this is progress.
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

gouessej
Administrator
Please note that I have never suggested to include Oracle proprietary JRE, I'm talking about OpenJDK, especially Adoptium/Eclipse Temurin. You can still report a bug against Ubuntu for your issue on its own OpenJDK build.

Are you already able to create a fat JAR? By the way, you could create a package that requires the openjdk-jre package to obtain something less big but it would require to report a bug against Ubuntu.

The error "SUNWprivate_1.1 not found" is fixed in JOGL 2.4.0 as far as I remember, it wasn't fixed in JOGL 2.3.2. Please run "sudo rm -fr /tmp/jogamp_*" if the problem persists. A more reliable solution on the very long term (but harder from a developer's point of view) consists in disabling the automated native library loading and setting the library path.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

gouessej
Administrator
In reply to this post by RickLutowski
Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

RickLutowski
In reply to this post by gouessej
gouesse wrote:
> The error "SUNWprivate_1.1 not found" is fixed in JOGL 2.4.0 as far as I remember, it wasn't fixed in
> JOGL 2.3.2.

Well, I decided to start over.  Downloaded the latest version based on the Download instructions:

" JARs for Java 3D 1.7 are here." (points to jogamp-java3d1.7.1-build-20200222.7z)
"The JogAmp (JOGL, JOAL, JOCL and GlueGen) fat JAR is here." (points to jogamp-fat-all.7z)

Unpacked the jars into my classpath, then recompiled the CM Surveyor source using OpenJDK11
(openjdk version "11.0.18" 2023-01-17)

Then ran the program using the command:

java --add-opens java.desktop/sun.awt=ALL-UNNAMED \
-cp /usr/local/_jreality:\
/usr/local/_jreality/j3dcore.jar:\
/usr/local/_jreality/j3dutils.jar:\
/usr/local/_jreality/vecmath.jar:\
/usr/local/_jreality/jogamp-fat.jar \
com.jreality.surveyor.gui.$1 $2 $3


CM Surveyor worked like in the old days!

Note that running without "--add-opens java.desktop/sun.awt=ALL-UNNAMED" give the message

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jogamp.java3d.JoglPipeline$1 (file:/usr/local/_jreality/j3dcore.jar) to method sun.awt.X11GraphicsDevice.getScreen()
WARNING: Please consider reporting this to the maintainers of org.jogamp.java3d.JoglPipeline$1
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
X11Util.Display: Shutdown (JVM shutdown: true, open (no close attempt): 1/1, reusable (open, marked uncloseable): 0, pending (open in creation order): 1)
X11Util: Open X11 Display Connections: 1
X11Util: Open[0]: NamedX11Display[:0, 0x7fd5940351f0, refCount 1, unCloseable false]

However the program still ran.

When I look into the MANIFEST.MF file for j3dcore.jar, it says:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: phil^M
Class-Path: vecmath-1.7.1.jar gluegen-rt-2.3.2.jar jogl-all-2.3.2.jar
Created-By: Apache Maven 3.5.3
Build-Jdk: 1.8.0_25

Apparently  jogl-2.4.0 may not be needed after all on OpenJDK11 since the manifest says the latest version is using  jogl-all-2.3.2.jar, and this works.  However, if someone wanted to try things with jogl-2.4.0, where can we get it?

Reply | Threaded
Open this post in threaded view
|

Re: Illegal reflective access with jogamp-java3d1.7.0-final

gouessej
Administrator
Sorry for the late reply, I missed your post somehow :s

When you use "-cp", you override the classpath, you use jogamp-fat.jar (which is obviously the JogAmp fat JAR containing the JOGL version you really use). The "Class-Path" manifest attribute is used when using "-jar" which is not your case.
Julien Gouesse | Personal blog | Website