You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Mike Hallan <mk...@gmx.com> on 2023/09/04 05:28:23 UTC

Exceptions on NB platform app startup

I continue to get execeptions on a NB platform app startup despite including
--add-opens as I have seen posted in several places.

I have struggled with this for longer than I would like to admit, I hope
someone can please help me resolve.



I am running NB19-rc5 (same was happening on NB16) and OpenJDK 18.0.2, Windows
10.



Specifically, I get two different exceptions upon starting an NB Platform app.

These exception trace msgs show in the IDE output when I start my application.
I don't see them after I start the built distribution stand-alone app,
although I'm guessing the exceptions msgs are just being hidden during the app
startup.

Apart from the execptions bothering me because they shouldn't be there, some
of the app users complain that the app will mysteriously work all OK on some
PCs (Windows 10) but on some other PCs (apparently Win Server 2016/2019) will
get a null pointer exception when the app tries to open the same file it
successfully opened on WIn 10 (XML UTF8). SO, I can't help but wonder whether
this could be related.



The exception msgs 1)..

org.netbeans.ProxyURLStreamHandlerFactory register  
SEVERE: No way to find original stream handler for jar protocol  
java.lang.reflect.InaccessibleObjectException: Unable to make field transient
java.net.URLStreamHandler java.net.URL.handler accessible: module java.base
does not "opens java.net" to unnamed module @1f17ae12  
    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:178)  
    at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)  
    at org.netbeans.ProxyURLStreamHandlerFactory.register(ProxyURLStreamHandlerFactory.java:59)  
    at org.netbeans.JarClassLoader.<clinit>(JarClassLoader.java:142)  
    at org.netbeans.MainImpl.execute(MainImpl.java:166)  
    at org.netbeans.MainImpl.main(MainImpl.java:60)  
    at org.netbeans.Main.main(Main.java:58)  
      
Followed by 2)..

WARNING: A terminally deprecated method in java.lang.System has been called  
WARNING: System::setSecurityManager has been called by
org.netbeans.TopSecurityManager
(file:/C:/Archive/Netbeans/19%20rc5/netbeans/platform/lib/boot.jar)  
WARNING: Please consider reporting this to the maintainers of
org.netbeans.TopSecurityManager  
WARNING: System::setSecurityManager will be removed in a future release  
INFO [org.netbeans.ui.metrics.laf]: USG_LOOK_AND_FEEL  
java.lang.IllegalAccessException: class org.netbeans.TopSecurityManager cannot
access class sun.awt.AppContext (in module java.desktop) because module
java.desktop does not export sun.awt to unnamed module @1f17ae12  
    at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)  
    at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)  
    at java.base/java.lang.reflect.Method.invoke(Method.java:560)  
    at org.netbeans.TopSecurityManager.makeSwingUseSpecialClipboard(TopSecurityManager.java:714)  
    at org.netbeans.core.NbLifecycleManager.advancePolicy(NbLifecycleManager.java:71)  
    at org.netbeans.core.GuiRunLevel.run(GuiRunLevel.java:84)  
    at org.netbeans.core.startup.Main.start(Main.java:316)  
    at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:98)  
    at java.base/java.lang.Thread.run(Thread.java:833)  
      
However, in myapp.conf I have included the many add-opens (I copied these from
netbeans_default_options in netbeans.conf).  
myapp.properties contains the line app.conf=myapp.conf  
So, I expected the following default_options in myapp.conf to have resolved
and prevented the above exceptions, but it doesn't:



default_options="-J-XX:+UseStringDeduplication -J-Xss2m
-J-Dapple.laf.useScreenMenuBar=true
-J-Dapple.awt.application.appearance=system
-J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true
-J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true
-J-Dplugin.manager.check.updates=false
-J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes  -J--add-
opens=java.base/java.net=ALL-UNNAMED -J--add-
opens=java.base/java.lang.ref=ALL-UNNAMED -J--add-
opens=java.base/java.lang=ALL-UNNAMED -J--add-
opens=java.base/java.security=ALL-UNNAMED -J--add-
opens=java.base/java.util=ALL-UNNAMED -J--add-opens=java.base/java.nio=ALL-
UNNAMED -J--add-exports=java.base/sun.reflect.annotation=ALL-UNNAMED -J--add-
opens=java.prefs/java.util.prefs=ALL-UNNAMED -J--add-
opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED -J--add-
opens=java.desktop/javax.swing.text=ALL-UNNAMED -J--add-
opens=java.desktop/javax.swing=ALL-UNNAMED -J--add-
opens=java.desktop/java.awt=ALL-UNNAMED -J--add-
opens=java.desktop/java.awt.event=ALL-UNNAMED -J--add-
opens=java.desktop/sun.awt.X11=ALL-UNNAMED -J--add-
opens=java.desktop/javax.swing.plaf.synth=ALL-UNNAMED -J--add-
opens=java.desktop/com.sun.java.swing.plaf.gtk=ALL-UNNAMED -J--add-
opens=java.desktop/sun.awt.shell=ALL-UNNAMED -J--add-
opens=java.desktop/sun.awt.im=ALL-UNNAMED -J--add-
exports=java.desktop/sun.awt=ALL-UNNAMED -J--add-
exports=java.desktop/java.awt.peer=ALL-UNNAMED -J--add-
exports=java.desktop/com.sun.beans.editors=ALL-UNNAMED -J--add-
exports=java.desktop/sun.swing=ALL-UNNAMED -J--add-
exports=java.desktop/sun.awt.im=ALL-UNNAMED -J--add-
exports=java.desktop/com.sun.java.swing.plaf.motif=ALL-UNNAMED -J--add-
exports=java.desktop/com.apple.eio=ALL-UNNAMED -J--add-
opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -J--add-
opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -J--add-
opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED -J--add-
opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED -J--add-
opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -J--add-
opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED -J--add-
opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED -J--add-
opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED -J--add-
opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED -J--add-
opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED -J--add-
opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -J--add-
exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -J--add-
exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -J--add-
exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED -J--add-
exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED -J--add-
exports=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -J--add-
exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED -J--add-
exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED -J--add-
exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED -J--add-
exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED -J--add-
exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED -J--add-
exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -J--add-
modules=jdk.jshell -J--add-opens=jdk.jshell/jdk.jshell=ALL-UNNAMED -J--add-
exports=jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED -J--add-
exports=jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED -J--add-
exports=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED -J--add-
exports=java.management/sun.management=ALL-UNNAMED
-J-XX:+IgnoreUnrecognizedVMOptions
-J-Djava.util.Arrays.useLegacyMergeSort=true -J-Xms256m -J-Xmx800m"  



What is missing or am I doing wrong please?



-Mike

\--------------------------------------------------------------------- To
unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org For additional
commands, e-mail: users-help@netbeans.apache.org For further information about
the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: Exceptions on NB platform app startup

Posted by Mike Hallan <mk...@gmx.com>.

I seem to have found a fix, mentioned by Neil Smith at
https://github.com/apache/netbeans/issues/5110

  
Some options need to be added to run.args.extra. So my project.properties file
now contains:



run.args.extra=-J--add-opens=java.base/java.net=ALL-UNNAMED -J--add-
exports=java.desktop/sun.awt=ALL-UNNAMED -J--add-
opens=java.desktop/javax.swing=ALL-UNNAMED



..and the application GUI now starts without any of the previous exceptions.  
I had thought that specifying these in default_options was enough, but
apparently its needed in run.args.extra when run as GUI.

\--------------------------------------------------------------------- To
unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org For additional
commands, e-mail: users-help@netbeans.apache.org For further information about
the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists