juanotto opened a new issue, #8903:
URL: https://github.com/apache/netbeans/issues/8903
### Apache NetBeans version
Apache NetBeans 27
### What happened
When a new Netbeans Platform Application is created, running it throws
`java.lang.reflect.InaccessibleObjectException`.
The maven archetype includes `jpms-flags` for the app module but they don't
seem to apply to runtime. Taking out the jpms-flag for java breaks the build,
but taking it out or adding it back doesn't seem to have any effect when
running the application.
Stacktrace when running the application includes:
```
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 @3b07d329
at
java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:353)
at
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:329)
at
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:277)
at
java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:179)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:173)
at
org.netbeans.ProxyURLStreamHandlerFactory.register(ProxyURLStreamHandlerFactory.java:59)
at org.netbeans.JarClassLoader.<clinit>(JarClassLoader.java:143)
at org.netbeans.MainImpl.execute(MainImpl.java:166)
at org.netbeans.MainImpl.main(MainImpl.java:60)
at org.netbeans.Main.main(Main.java:58)
```
The application can run, it just has no access to `java.net`.
### Language / Project Type / NetBeans Component
Netbeans Platform
### How to reproduce
Create a new Netbeans application, build and run it.
Note: you may need to take out the security-manager flag as per
https://github.com/apache/netbeans-mavenutils-archetype-netbeans-platform-app-archetype/pull/19
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Both Windows 10 and Ubuntu 24
### JDK
Oracle jdk-24
### Apache NetBeans packaging
Apache NetBeans platform
### Anything else
I created a PR that solves the issue, but I suspect there are better ways.
See
https://github.com/apache/netbeans-mavenutils-archetype-netbeans-platform-app-archetype/pull/20
I couldn't find information on who processes the jpms-flags used in the pom.
That may be a better place to actually use the same flags on runtime. Is the
`nbm-maven-plugin`?
### Are you willing to submit a pull request?
Yes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists