[ 
https://issues.apache.org/jira/browse/BROOKLYN-351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15522965#comment-15522965
 ] 

Svetoslav Neykov commented on BROOKLYN-351:
-------------------------------------------

[~aled.sage] Agree with your analysis. I can suggest a 3rd option - invalidate 
the cache on bundle load, but will happily trade that for your option 2 which 
seems ideal.

With that said currently Brooklyn's feature loading is set up to avoid this by 
starting the locations-jclouds bundle *after* all jclouds bundles. It does it 
by setting a [start level of 
85|https://github.com/apache/brooklyn-server/blob/master/karaf/features/src/main/feature/feature.xml#L300],
 while the default (which includes jclouds bundles) is 80.

Short term make sure your location bundles are loaded in the same feature 
loading batch (by playing with prerequisite attribute) or previous one and that 
their startup level is less than 85. Longer term I suggest we go with (2).

> extra jclouds providers not found (in karaf)
> --------------------------------------------
>
>                 Key: BROOKLYN-351
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-351
>             Project: Brooklyn
>          Issue Type: Bug
>            Reporter: Aled Sage
>
> When using a downstream build of Brooklyn 0.10.0-SNAPSHOT (with karaf), I 
> added a couple of extra jclouds labs providers/apis via the feature.xml.
> However, when I tried to use it with the blueprint below, I got the error 
> shown:
> {noformat}
> location: jclouds:azurecompute
> services:
> - type: org.apache.brooklyn.entity.stock.BasicApplication
> 2016-09-26 12:10:12,346 DEBUG 115 o.a.b.c.t.AbstractTypePlanTransformer 
> [p1212877220-1463] Could not instantiate BasicRegisteredType[null;null] 
> (rethrowing): Illegal parameter for 'location' (jclouds:azurecompute); not 
> resolvable: NoSuchElementException: Cloud provider/
> API type azurecompute is not supported by jclouds
> {noformat}
> Looking in {{org.jclouds.providers.Providers.withId("azurecompute")}}, 
> jclouds does know about azurecompute.
> The problem is that the providers/apis list are retrieved and stored in 
> {{JcloudsLocationResolver.PROVIDERS}} and {{JcloudsLocationResolver.APIS}} 
> (during static init). At that point, the azurecompute bundle has not been 
> activated, so {{org.jclouds.osgi.ProviderRegistry}} had not yet had it added 
> by {{org.jclouds.osgi.MetadataBundleListener}}.
> Below is a stacktrace of where this happens:
> {noformat}
> Daemon Thread [FelixStartLevel] (Suspended (breakpoint at line 82 in 
> Providers))      
>       owns: AtomicBoolean  (id=1573)  
>       Providers.all() line: 82        
>       JcloudsLocationResolver.getProvidersMap() line: 61      
>       JcloudsLocationResolver.<clinit>() line: 56     
>       NativeConstructorAccessorImpl.newInstance0(Constructor, Object[]) line: 
> not available [native method]   
>       NativeConstructorAccessorImpl.newInstance(Object[]) line: 57    
>       DelegatingConstructorAccessorImpl.newInstance(Object[]) line: 45        
>       Constructor<T>.newInstance(Object...) line: 526 
>       ReflectionUtils.newInstance(AccessControlContext, Constructor, 
> Object...) line: 331     
>       BeanRecipe.newInstance(Constructor, Object...) line: 984        
>       BeanRecipe.getInstanceFromType(List<Object>, List<ReifiedType>) line: 
> 349       
>       BeanRecipe.getInstance() line: 282      
>       BeanRecipe.internalCreate2() line: 830  
>       BeanRecipe.internalCreate() line: 811   
>       BeanRecipe(AbstractRecipe).create() line: 106   
>       RefRecipe.internalCreate() line: 62     
>       RefRecipe(AbstractRecipe).create() line: 106    
>       ServiceRecipe.createService() line: 285 
>       ServiceRecipe.internalGetService(Bundle, ServiceRegistration) line: 252 
>       ServiceRecipe.internalCreate() line: 149        
>       AbstractRecipe$1.call() line: 79        
>       FutureTask<V>.run() line: 262   
>       ServiceRecipe(AbstractRecipe).create() line: 88 
>       BlueprintRepository.createInstances(Collection<String>) line: 255       
>       BlueprintRepository.createAll(Collection<String>) line: 186     
>       BlueprintContainerImpl.instantiateEagerComponents() line: 712   
>       BlueprintContainerImpl.doRun() line: 399        
>       BlueprintContainerImpl.run() line: 273  
>       BlueprintExtender.createContainer(Bundle, List<Object>) line: 294       
>       BlueprintExtender.createContainer(Bundle) line: 263     
>       BlueprintExtender.modifiedBundle(Bundle, BundleEvent, Object) line: 253 
>       BundleHookBundleTracker$Tracked.customizerModified(Bundle, BundleEvent, 
> T) line: 500    
>       BundleHookBundleTracker$Tracked.customizerModified(Object, Object, 
> Object) line: 433    
>       
> BundleHookBundleTracker$Tracked(BundleHookBundleTracker$AbstractTracked<S,T,R>).track(S,
>  R) line: 725   
>       BundleHookBundleTracker$Tracked.bundleChanged(BundleEvent) line: 463    
>       BundleHookBundleTracker$BundleEventHook.event(BundleEvent, Collection) 
> line: 422        
>       SecureAction.invokeBundleEventHook(EventHook, BundleEvent, 
> Collection<BundleContext>) line: 1179        
>       EventDispatcher.createWhitelistFromHooks(EventObject, Framework, 
> Map<BundleContext,List<ListenerInfo>>, Map<BundleContext,List<ListenerInfo>>, 
> Class<T>) line: 731      
>       EventDispatcher.fireBundleEvent(BundleEvent, Framework) line: 486       
>       Felix.fireBundleEvent(int, Bundle) line: 4541   
>       Felix.startBundle(BundleImpl, int) line: 2172   
>       Felix.setActiveStartLevel(int, FrameworkListener[]) line: 1371  
>       FrameworkStartLevelImpl.run() line: 308 
>       Thread.run() line: 745  
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to