eugene rabii Messages: 13 Registered: February 2012
Junior Member
Environment : Java 6; virgo-3.5.0.RELEASE.
The problem: I am trying to block calls fro OSGi bundles to System.exit. From plain Java, this is very easy. Extend the SecurityManager, override a method and done!
Well, now Virgo . Here is the class:
private static class BlockExit extends SecurityManager {
@Override
public void checkExit(int status){
throw new UnsupportedOperationException("Not Allowed!");
}
}
And inside the start from BundleActivator:
System.setSecurityManager(new BlockExit());
Seems pretty straightforward, but it's not working. There are A LOT of exceptions in log, mainly:
xception in thread "[Timer] - Main Queue Handler" java.lang.IllegalArgumentException: java.security.AccessCo
ntrolException: access denied (org.osgi.framework.ServicePermission (service.id=8) get)
And most recent: Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
Is there a way to use the security manager in Virgo?