You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Dennis Geurts <de...@luminis.nl> on 2009/06/29 10:44:40 UTC

Embedding Felix in host app with a SecurityManager

Hi felix dev,


I'm in a situation where I'd like to embed Apache Felix in a host  
application. The host application, however is equipped with a security  
manager
that does not allow for the creation of a new security manager. This  
leads to the following error on startup:

	at org.mortbay.thread.BoundedThreadPool 
$PoolThread.run(BoundedThreadPool.java:442)
Caused by: java.lang.ExceptionInInitializerError
	at  
org 
.apache.felix.framework.ExtensionManager.<init>(ExtensionManager.java: 
142)
	at org.apache.felix.framework.Felix.<init>(Felix.java:301)
	at net.luminis.testdgg.server.Framework.<init>(Framework.java:39)
	at  
net.luminis.testdgg.server.OSGiServiceImpl.start(OSGiServiceImpl.java: 
24)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at  
sun 
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 
39)
	at  
sun 
.reflect 
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 
25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	... 25 more
Caused by: java.security.AccessControlException: access denied  
(java.lang.RuntimePermission createSecurityManager)
	at  
java 
.security 
.AccessControlContext.checkPermission(AccessControlContext.java:264)
	at  
java.security.AccessController.checkPermission(AccessController.java: 
427)


This happens because Felix extends the SecurityManager in  
SecurityManagerEx to allow for public access to getClassContext().
I do not see an easy way to overcome this situation. Am I missing  
something ?


thanks in advance,


dennis



Re: Embedding Felix in host app with a SecurityManager

Posted by Dennis Geurts <de...@luminis.nl>.
Hi Karl,

thanks, I figured as much... I'll see if i can make it work. I'll keep  
you posted.


cheers, dennis


On 29 jun 2009, at 10:56, Karl Pauls wrote:

> Thats a tricky one. Generally speaking, the framework needs
> AllPermission (as per spec). If that's not possible then things are
> getting really tricky. Sorry.
>
> You could try to hack stuff to not use the ExtensionManager and
> disable URLHandlers and see whether that makes it work...
>
> regards,
>
> Karl
>
> On Mon, Jun 29, 2009 at 10:44 AM, Dennis Geurts<dennis.geurts@luminis.nl 
> > wrote:
>> Hi felix dev,
>>
>>
>> I'm in a situation where I'd like to embed Apache Felix in a host
>> application. The host application, however is equipped with a  
>> security
>> manager
>> that does not allow for the creation of a new security manager.  
>> This leads
>> to the following error on startup:
>>
>>        at
>> org.mortbay.thread.BoundedThreadPool 
>> $PoolThread.run(BoundedThreadPool.java:442)
>> Caused by: java.lang.ExceptionInInitializerError
>>        at
>> org 
>> .apache 
>> .felix.framework.ExtensionManager.<init>(ExtensionManager.java:142)
>>        at org.apache.felix.framework.Felix.<init>(Felix.java:301)
>>        at  
>> net.luminis.testdgg.server.Framework.<init>(Framework.java:39)
>>        at
>> net 
>> .luminis.testdgg.server.OSGiServiceImpl.start(OSGiServiceImpl.java: 
>> 24)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun 
>> .reflect 
>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>> sun 
>> .reflect 
>> .DelegatingMethodAccessorImpl 
>> .invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:585)
>>        ... 25 more
>> Caused by: java.security.AccessControlException: access denied
>> (java.lang.RuntimePermission createSecurityManager)
>>        at
>> java 
>> .security 
>> .AccessControlContext.checkPermission(AccessControlContext.java:264)
>>        at
>> java 
>> .security.AccessController.checkPermission(AccessController.java:427)
>>
>>
>> This happens because Felix extends the SecurityManager in  
>> SecurityManagerEx
>> to allow for public access to getClassContext().
>> I do not see an easy way to overcome this situation. Am I missing  
>> something
>> ?
>>
>>
>> thanks in advance,
>>
>>
>> dennis
>>
>>
>>
>
>
>
> -- 
> Karl Pauls
> karlpauls@gmail.com


Re: Embedding Felix in host app with a SecurityManager

Posted by Karl Pauls <ka...@gmail.com>.
Thats a tricky one. Generally speaking, the framework needs
AllPermission (as per spec). If that's not possible then things are
getting really tricky. Sorry.

You could try to hack stuff to not use the ExtensionManager and
disable URLHandlers and see whether that makes it work...

regards,

Karl

On Mon, Jun 29, 2009 at 10:44 AM, Dennis Geurts<de...@luminis.nl> wrote:
> Hi felix dev,
>
>
> I'm in a situation where I'd like to embed Apache Felix in a host
> application. The host application, however is equipped with a security
> manager
> that does not allow for the creation of a new security manager. This leads
> to the following error on startup:
>
>        at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
> Caused by: java.lang.ExceptionInInitializerError
>        at
> org.apache.felix.framework.ExtensionManager.<init>(ExtensionManager.java:142)
>        at org.apache.felix.framework.Felix.<init>(Felix.java:301)
>        at net.luminis.testdgg.server.Framework.<init>(Framework.java:39)
>        at
> net.luminis.testdgg.server.OSGiServiceImpl.start(OSGiServiceImpl.java:24)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        ... 25 more
> Caused by: java.security.AccessControlException: access denied
> (java.lang.RuntimePermission createSecurityManager)
>        at
> java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
>        at
> java.security.AccessController.checkPermission(AccessController.java:427)
>
>
> This happens because Felix extends the SecurityManager in SecurityManagerEx
> to allow for public access to getClassContext().
> I do not see an easy way to overcome this situation. Am I missing something
> ?
>
>
> thanks in advance,
>
>
> dennis
>
>
>



-- 
Karl Pauls
karlpauls@gmail.com