Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » ConditionalPermissionAdmin and equinox.ds
ConditionalPermissionAdmin and equinox.ds [message #661208] Wed, 23 March 2011 15:22 Go to next message
Johannes  is currently offline Johannes
Messages: 5
Registered: March 2011
Junior Member
hi, i have a problem when i try to update my ConditionalPermissionInfo i get this exception

Exception in thread "Component Resolve Thread (Bundle 2)" java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at org.eclipse.osgi.internal.permadmin.EquinoxSecurityManager.i nternalCheckPermission(EquinoxSecurityManager.java:117)
at org.eclipse.osgi.internal.permadmin.EquinoxSecurityManager$C heckPermissionAction.run(EquinoxSecurityManager.java:60)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.internal.permadmin.EquinoxSecurityManager.c heckPermission(EquinoxSecurityManager.java:88)
at org.eclipse.osgi.internal.permadmin.EquinoxSecurityManager.c heckPermission(EquinoxSecurityManager.java:187)
at java.lang.Thread.getContextClassLoader(Unknown Source)
at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Execut or.run(Executor.java:81)

when i type in ss i see that bundle 2 is equinox.ds
2 ACTIVE org.eclipse.equinox.ds_1.2.1.R36x_v20100803

does anyone have a idea whats wrong?

kind regards
Johannes

Code:
ConditionalPermissionUpdate update = adm
.newConditionalPermissionUpdate();
List<ConditionalPermissionInfo> conditionalPermissionInfos = update
.getConditionalPermissionInfos();
conditionalPermissionInfos.add(info);
boolean commit = update.commit();




[Updated on: Wed, 23 March 2011 15:24]

Report message to a moderator

Re: ConditionalPermissionAdmin and equinox.ds [message #661216 is a reply to message #661208] Wed, 23 March 2011 15:39 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas Watson
Messages: 427
Registered: July 2009
Senior Member
It would appear that you did not grant the bundle org.eclipse.equinox.util the necessary permissions required for it. This bundle requires AllPermission.

This bundle is used by DS for some utility classes. In this case DS is using some thread pooling API in the org.eclipse.equinox.util bundle and this code requires AllPermissions to work properly.

Tom
Re: ConditionalPermissionAdmin and equinox.ds [message #661408 is a reply to message #661216] Thu, 24 March 2011 14:47 Go to previous messageGo to next message
Johannes  is currently offline Johannes
Messages: 5
Registered: March 2011
Junior Member
Thanks alot your solution solved my problem Wink
But now i have a diffrent problem i get no exception anymore but the ConditionalPermissionAdmin dosent recognize my Custom Condition anymore. The condition is placed in a fragment of the system.bundle.
kind regards
Johannes
Re: ConditionalPermissionAdmin and equinox.ds [message #661425 is a reply to message #661408] Thu, 24 March 2011 15:44 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas Watson
Messages: 427
Registered: July 2009
Senior Member
I'm sure you have already checked this, but make sure you are using the correctly spelled fully qualified class name for you custom condition when setting up the ConditionInfo. Other than that, it should work as long as your fragment is resolved and attached to the system bundle.

Tom.
Re: ConditionalPermissionAdmin and equinox.ds [message #662354 is a reply to message #661425] Wed, 30 March 2011 11:07 Go to previous messageGo to next message
Johannes  is currently offline Johannes
Messages: 5
Registered: March 2011
Junior Member
Thanks for your help. I made some progress and got the ConditionalPermissonAdmin running with a osgi launch configuration.
But when i try to do the same as eclipse launchconfig with an eclipse app it failes somehow.
Does anyone know whats the diffrence between osgi app and eclipse app when security is enabled?

kind regards
Johannes

My OSGI-Config:
-Declipse.security=org.eclipse.osgi.internal.permadmin.Equin oxSecurityManager
-Djava.security.policy=" ${project_loc:de.jkoslows.permission.admin.config}/java.poli cy "

eclipse is the same but it seems that the app does not recognize the java.policy


Re: ConditionalPermissionAdmin and equinox.ds [message #662377 is a reply to message #662354] Wed, 30 March 2011 12:55 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas Watson
Messages: 427
Registered: July 2009
Senior Member
Questions:

I assume when you say launch configuration you mean when you launch the eclipse app the osgi app from the Eclipse IDE?

If so both of these should use the same launching code that enables the security manager in the same way. Can you give more information on what the failure is when launching the eclipse app?

Tom.
Re: ConditionalPermissionAdmin and equinox.ds [message #662382 is a reply to message #661208] Wed, 30 March 2011 13:23 Go to previous messageGo to next message
Johannes  is currently offline Johannes
Messages: 5
Registered: March 2011
Junior Member
Thanks for your replies Thomas. yes iam starting the app's inside the ide. When i start the osgi app everything is working fine so far. If i start an eclipse app it immediately crashes. permission config is exactly the same.

stacktrace e.g.:
!ENTRY org.eclipse.equinox.common 4 0 2011-03-30 15:18:40.882
!MESSAGE
!STACK 0
org.osgi.framework.BundleException: The bundle "org.eclipse.equinox.common_3.6.0.v20100503 " could not be resolved. Reason: Missing Permission: (org.osgi.framework.PackagePermission org.eclipse.osgi.framework.log import), Missing Constraint: Import-Package: org.eclipse.osgi.framework.log; version="0.0.0"
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getR esolverError(AbstractBundle.java:1317)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getR esolutionFailureException(AbstractBundle.java:1301)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:319)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resu me(AbstractBundle.java:374)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBun dle(Framework.java:1067)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:561)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:546)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.i ncFWSL(StartLevelManager.java:459)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.d oSetStartLevel(StartLevelManager.java:243)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.d ispatchEvent(StartLevelManager.java:440)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(EventManager.java:227)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread .run(EventManager.java:337)

!ENTRY org.eclipse.core.runtime 4 0 2011-03-30 15:18:40.898
!MESSAGE
!STACK 0
org.osgi.framework.BundleException: The bundle "org.eclipse.core.runtime_3.6.0.v20100505 [2]" could not be resolved. Reason: Missing Permission: (org.osgi.framework.BundlePermission org.eclipse.osgi require), Missing Constraint: Require-Bundle: org.eclipse.osgi; bundle-version="[3.5.0,4.0.0)"
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getR esolverError(AbstractBundle.java:1317)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getR esolutionFailureException(AbstractBundle.java:1301)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:319)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resu me(AbstractBundle.java:374)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBun dle(Framework.java:1067)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:561)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.r esumeBundles(StartLevelManager.java:546)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.i ncFWSL(StartLevelManager.java:459)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.d oSetStartLevel(StartLevelManager.java:243)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.d ispatchEvent(StartLevelManager.java:440)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEve nt(EventManager.java:227)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread .run(EventManager.java:337)

etc....










Re: ConditionalPermissionAdmin and equinox.ds [message #662900 is a reply to message #662382] Fri, 01 April 2011 12:27 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas Watson
Messages: 427
Registered: July 2009
Senior Member
Are you sure this is not simply because there are more bundles being included in the eclipse application launch for which do not have adequate permissions? Seems the org.eclipse.core.runtime and org.eclipse.equinox.common don't have the necessary PackagePermission and BundlePermission to resolve.

Tom
Re: ConditionalPermissionAdmin and equinox.ds [message #708131 is a reply to message #662900] Tue, 02 August 2011 13:50 Go to previous message
Johannes  is currently offline Johannes
Messages: 5
Registered: March 2011
Junior Member
Thanks for your help tom. iam now able to understand how the conditionalpermissionadmin and osgi r4.2 security works. i found all information i needed to solve my problems, in the book by Richard Hall et al (OSGi in action).
kind regards


Previous Topic:Problem with p2 headless update with <no connection> case in eclipse 3.7
Next Topic:Classloader problem when deserializing
Goto Forum:
  


Current Time: Fri Sep 19 16:08:48 GMT 2014

Powered by FUDForum. Page generated in 0.02342 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software