You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "homberghp (via GitHub)" <gi...@apache.org> on 2024/11/29 11:00:32 UTC
[I] netbeans 24 will not start on java 24-ea due to security manager permanently disabled. [netbeans]
homberghp opened a new issue, #8008:
URL: https://github.com/apache/netbeans/issues/8008
### Apache NetBeans version
Apache NetBeans 24 release candidate
### What happened
Setting JAVA_HOME to java 24 (ea-25) make the netbeans startup (using the commandline) exit prematurely with the following message
```
Error occurred during initialization of VM
java.lang.Error: A command line option has attempted to allow or enable the Security Manager. Enabling a Security Manager is not supported.
at java.lang.System.initPhase3(java.base@24-ea/System.java:2070)
```
### Language / Project Type / NetBeans Component
netbeans startup
### How to reproduce
Freshly install netbeans 24 rc 4 from zip to a dir, `/usr/local/netbeans-24-rc4` in my case.
On linux then do : `export JAVA_HOME=/usr/lib/jvm/jdk-24; /usr/local/netbeans-24-rc4/bin/netbeans`
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Linux Ubuntu 24.04 LTS
### JDK
OpenJDK 64-Bit Server VM (build 24-ea+25-3155, mixed mode, sharing)
### Apache NetBeans packaging
Apache NetBeans binary zip
### Anything else
always on java 24
### Are you willing to submit a pull request?
No
--
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: notifications-unsubscribe@netbeans.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] netbeans 24 will not start on java 24-ea due to security manager permanently disabled. [netbeans]
Posted by "homberghp (via GitHub)" <gi...@apache.org>.
homberghp commented on issue #8008:
URL: https://github.com/apache/netbeans/issues/8008#issuecomment-2507678175
# A patch.
This might work. It is a hack. Disable the setting of the System.setSecurityManager in TopSecrurityManager, while leaving the remainder of the utility in the TopSecurityManager in tact. But one should prepare for final removal of said TopSecurityManager. It appears to work in `ant tryme`. Short test with create new maven javaproject and run that.
2 patches:
* For the TopSecurityManager, see below
* for the nbexec launcher. This is for the Unix variant only. Have not yet investigated windows. (Currently can't build on Windows)
Patch for nbexec
```
diff --git a/platform/o.n.bootstrap/launcher/unix/nbexec b/platform/o.n.bootstrap/launcher/unix/nbexec
index 1d6ad6e530..8b4a830836 100755
--- a/platform/o.n.bootstrap/launcher/unix/nbexec
+++ b/platform/o.n.bootstrap/launcher/unix/nbexec
@@ -192,7 +192,7 @@ fi
# rename old heap dump to .old
mv "${userdir}/var/log/heapdump.hprof" "${userdir}/var/log/heapdump.hprof.old" > /dev/null 2>&1
-jargs_without_clusters="$jargs -Djava.security.manager=allow"
+jargs_without_clusters="$jargs -Djava.security.manager=disallow"
jargs="-Dnetbeans.dirs=\"${clusters}\" $jargs_without_clusters"
if [ -z "$cachedirspecified" ]; then
```
Patch for the TopSecurityManager:
```
diff --git a/platform/o.n.bootstrap/src/org/netbeans/TopSecurityManager.java b/platform/o.n.bootstrap/src/org/netbeans/TopSecurityManager.java
index babb04da60..c89bd13f3d 100644
--- a/platform/o.n.bootstrap/src/org/netbeans/TopSecurityManager.java
+++ b/platform/o.n.bootstrap/src/org/netbeans/TopSecurityManager.java
@@ -48,6 +48,15 @@ import org.openide.util.WeakSet;
* @author Ales Novak, Jesse Glick
*/
public class TopSecurityManager extends SecurityManager {
+ /** Due to permanent deprecation of the java security manager we simply hack an instance,
+ so the utilities in this class are still available.
+ *
+ * This is a HACK.
+ * This behaves as a eager singleton.
+ */
+ private static TopSecurityManager INSTANCE = new TopSecurityManager();
+ // end of hack.
+
private static final boolean check = !Boolean.getBoolean("netbeans.security.nocheck"); // NOI18N
private static final Logger LOG = Logger.getLogger(TopSecurityManager.class.getName());
@@ -166,14 +175,14 @@ public class TopSecurityManager extends SecurityManager {
static boolean officialExit = false;
static Class<?>[] getStack() {
- SecurityManager s = System.getSecurityManager();
- TopSecurityManager t;
- if (s instanceof TopSecurityManager) {
- t = (TopSecurityManager)s;
- } else {
- t = new TopSecurityManager();
- }
- return t.getClassContext();
+// SecurityManager s = System.getSecurityManager();
+// TopSecurityManager t;
+// if (s instanceof TopSecurityManager) {
+// t = (TopSecurityManager)s;
+// } else {
+// t = new TopSecurityManager();
+// }
+ return INSTANCE.getClassContext();
}
/** Can be called from core classes to exit the system.
@@ -521,15 +530,17 @@ public class TopSecurityManager extends SecurityManager {
}
public static void install() {
- try {
- System.setSecurityManager(new TopSecurityManager());
- } catch (SecurityException ex) {
- LOG.log(Level.WARNING, "Cannot associated own security manager"); // NOI18N
- LOG.log(Level.INFO, "Cannot associated own security manager", ex); // NOI18N
- }
+ // sec man is deprecated
+// try {
+// System.setSecurityManager(new TopSecurityManager());
+// } catch (SecurityException ex) {
+// LOG.log(Level.WARNING, "Cannot associated own security manager"); // NOI18N
+// LOG.log(Level.INFO, "Cannot associated own security manager", ex); // NOI18N
+// }
}
static void uninstall() {
- System.setSecurityManager(null);
+ // sec man is deprecated
+// System.setSecurityManager(null);
}
/** Prohibits to set another SecurityManager */
```
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] netbeans 24 will not start on java 24-ea due to security manager permanently disabled. [netbeans]
Posted by "hoijui (via GitHub)" <gi...@apache.org>.
hoijui commented on issue #8008:
URL: https://github.com/apache/netbeans/issues/8008#issuecomment-2608928244
I get this issue for Netbeans 24 (latest release) also on JDK 23 (don't have 24 installed). it does not happen with 17 (though there I have an other issue (grey screen of death)).
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] netbeans 24 will not start on java 24-ea due to security manager permanently disabled. [netbeans]
Posted by "homberghp (via GitHub)" <gi...@apache.org>.
homberghp commented on issue #8008:
URL: https://github.com/apache/netbeans/issues/8008#issuecomment-2567013674
# Issue no longer relevant.
Recent pull of NetBeans sources and subsequent build no longer has the issue.
Propose to close the issue.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] netbeans 24 will not start on java 24-ea due to security manager permanently disabled. [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on issue #8008:
URL: https://github.com/apache/netbeans/issues/8008#issuecomment-2507762677
This is a known issue that needs to be resolved for NetBeans 25. See #3386 and #7928 for options under consideration.
NetBeans 24 will not support running on JDK 24. You might be able to remove the option in the launcher and just pass the system property to disable the security manager - shouldn't need to recompile, for Linux and macOS at least.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [I] netbeans 24 will not start on java 24-ea due to security manager permanently disabled. [netbeans]
Posted by "homberghp (via GitHub)" <gi...@apache.org>.
homberghp closed issue #8008: netbeans 24 will not start on java 24-ea due to security manager permanently disabled.
URL: https://github.com/apache/netbeans/issues/8008
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists