Schlagwort-Archive: osgi

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

Blocking system.exit in osgi

One thing beforehand, calling system.exit from a bundle is evil!
But even worse is a third party legacy jar calling system.exit instead of throwing exceptions. Now how do we stop this jar from doing such evil?
The only way you can do this is to use a SecurityManager preventing calls to system.exit. Wow!!!
Now how am I supposed to do something like that in an OSGi world?
This is where the security bundle of felix comes in place.


Just did finish most parts of the issue PAXWEB-210 I was working on now for about two weeks. While I was working on this issue I have seen a lot of code. That is one of the reasons why I was able to fix quite some bugs. I also added on requested improvement PAXWEB-193. I needed this to easely add „UserRealm“ objects to the server configuration, another way of configuring the pax-web jetty server is to add a fragment containing the configuration which I personaly dislike. All of the changes can be found on github here. Go ahead and review 🙂