Just the other day I was able to finaly finish my work on PAXWEB-210.
This took me a while, after the upgrade to Jetty7 the configuration of the SecurityRealm through the web.xml descritptor didn’t work anymore. 🙁
The issue on this has been, that the context of the application was already started. I was able to work around this, and finally the realm can be configured before the context is started again.

Blocking system.exit in OSGi (Part IV)

Hey, I finally made it. After seeking for more help on the felix list (didn’t help any) I got into the problem and solved it. Here is the complete set of what you need to get around the issue of an system.exit in your Bundle.

First of all you need to configure the availability of a SecurityManager with your Framework. Now the following Changes should work both with Equinox and Felix.
The second thing you need to know about is the PermissionAdmin Service Specification.

Configuration using Equinox

Blocking system.exit in osgi (Part III)

Hey, finally Felix is running with security also 🙂
No big changes needed.
As mentioned before the


is neede within the startup config (Equinox didn’t need this one)
The are setup only contain the
entry and the only contain this:${karaf.base}/etc/all.policy

An additional File called security.policy is also added to the etc folder, but somehow the content doesn’t seem to be parsed, even though the SecurityManager of Felix should consume this file.
Anyway here is the content I added to the file:

( java.lang.RuntimePermission "exitVM")
( "*" "*")

Blocking system.exit in osgi (Part II)

After failing the last time I did some more research on how to get the security manager enabled.
Lukily I found some discussion about this issue on a mailinglist.
I resolved this issue at least with the equinox framework. The Felix didn’t work yet. I will do some more in depth research on this later on.

Now how do we get this SecurityManager running with the Equinox OSGi Container?
We need another parameter specialized for Equinox. So we end up with a file that has the following entries:


The critical entries are set in the${karaf.base}/etc/all.policy