You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by "Aled Sage (JIRA)" <ji...@apache.org> on 2017/12/11 17:14:00 UTC

[jira] [Commented] (BROOKLYN-569) Aggregator enricher lost on rebind (due to ClassCastException)

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

Aled Sage commented on BROOKLYN-569:
------------------------------------

A fix would be for {{MathAggregatorFunctions}} to try to coerce the value, if it is not already a number.

> Aggregator enricher lost on rebind (due to ClassCastException)
> --------------------------------------------------------------
>
>                 Key: BROOKLYN-569
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-569
>             Project: Brooklyn
>          Issue Type: Bug
>            Reporter: Aled Sage
>
> I had an aggregator for {{systemload.average}} on the cluster. On rebind, it failed with the {{ClassCastException}} shown below. The consequence (I think?) is that the enricher is not added to the entity.
> {noformat}
> 2017-10-17T10:37:37,748 WARN  122 o.a.b.e.s.Aggregator [FelixStartLevel] Error calculating and setting aggregate for enricher Aggregator{name=org.apache.brooklyn.enricher.stock.Aggregator, running=true, entity=DynamicClusterImpl{id=pp5qg4p26r}, id=y9jnikf9in}
> java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
>         at org.apache.brooklyn.enricher.stock.MathAggregatorFunctions$BasicComputingNumber.apply(MathAggregatorFunctions.java:121) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.enricher.stock.MathAggregatorFunctions$BasicComputingNumber.apply(MathAggregatorFunctions.java:110) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.enricher.stock.Aggregator.compute(Aggregator.java:252) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.enricher.stock.Aggregator.onUpdated(Aggregator.java:239) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.enricher.stock.AbstractAggregator.setEntity(AbstractAggregator.java:147) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.core.entity.AbstractEntity$BasicEnricherSupport.add(AbstractEntity.java:1686) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.BasicEntityRebindSupport.addEnrichers(BasicEntityRebindSupport.java:140) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.BasicEntityRebindSupport.addEnrichers(BasicEntityRebindSupport.java:55) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.associateAdjunctsWithEntities(RebindIteration.java:681) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.doRun(RebindIteration.java:258) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.InitialFullRebindIteration.doRun(InitialFullRebindIteration.java:69) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.run(RebindIteration.java:280) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl.rebindImpl(RebindManagerImpl.java:538) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl.lambda$rebind$0(RebindManagerImpl.java:494) ~[122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.util.core.task.BasicExecutionContext$1.call(BasicExecutionContext.java:143) [122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.util.core.task.BasicExecutionContext$1.call(BasicExecutionContext.java:141) [122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.util.core.task.BasicExecutionContext.runInSameThread(BasicExecutionContext.java:227) [122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.util.core.task.BasicExecutionContext.get(BasicExecutionContext.java:141) [122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl.rebind(RebindManagerImpl.java:493) [122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.launcher.common.BasicLauncher.startPersistenceWithoutHA(BasicLauncher.java:649) [126:org.apache.brooklyn.launcher-common:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.launcher.common.BasicLauncher.startPersistence(BasicLauncher.java:611) [126:org.apache.brooklyn.launcher-common:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.launcher.common.BasicLauncher.handlePersistence(BasicLauncher.java:501) [126:org.apache.brooklyn.launcher-common:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.launcher.common.BasicLauncher.startPartTwo(BasicLauncher.java:418) [126:org.apache.brooklyn.launcher-common:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.launcher.osgi.OsgiLauncherImpl.startOsgi(OsgiLauncherImpl.java:116) [333:org.apache.brooklyn.karaf-init:1.0.0.SNAPSHOT]
>         at Proxy15e05ead_d753_4d2d_a439_dc3559cde5b4.startOsgi(Unknown Source) [?:?]
>         at org.apache.brooklyn.launcher.osgi.start.OsgiLauncherCompleter.init(OsgiLauncherCompleter.java:36) [335:org.apache.brooklyn.karaf-start:1.0.0.SNAPSHOT]
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
>         at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
>         at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:299) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:980) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:736) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:848) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79) [15:org.apache.aries.blueprint.core:1.8.2]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
>         at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:255) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:186) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:704) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:410) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:275) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:300) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:269) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:265) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:255) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422) [15:org.apache.aries.blueprint.core:1.8.2]
>         at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179) [?:?]
>         at org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730) [?:?]
>         at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485) [?:?]
>         at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4563) [?:?]
>         at org.apache.felix.framework.Felix.startBundle(Felix.java:2173) [?:?]
>         at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1372) [?:?]
>         at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308) [?:?]
>         at java.lang.Thread.run(Thread.java:748) [?:?]
> {noformat}
> Looking earlier in the log, the enricher logged errors about {{ClassCastException}} when getting these values:
> {noformat}
> 2017-10-17T09:36:32,175 DEBUG 122 b.SSH [r-ZF3eryKq-46157] ssh-feed, on machine SshMachineLocation[34.241.80.46:aled@ec2-34-241-80-46.eu-west-1.compute.amazonaws.com/34.241.80.46:22(id=e8oofbfbv4)], completed: return st
> atus 0
> 2017-10-17T09:36:32,176 WARN  122 o.a.b.e.s.Aggregator [r-ZF3eryKq-46162] Error calculating and setting aggregate for enricher Aggregator{running=true, entity=DynamicClusterImpl{id=pp5qg4p26r}, id=y9jnikf9in}
> java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
>         at org.apache.brooklyn.enricher.stock.MathAggregatorFunctions$BasicComputingNumber.apply(MathAggregatorFunctions.java:121) [122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.enricher.stock.MathAggregatorFunctions$BasicComputingNumber.apply(MathAggregatorFunctions.java:110) [122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.enricher.stock.Aggregator.compute(Aggregator.java:252) [122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.enricher.stock.Aggregator.onUpdated(Aggregator.java:239) [122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.enricher.stock.Aggregator.onEvent(Aggregator.java:233) [122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.internal.LocalSubscriptionManager$1.run(LocalSubscriptionManager.java:345) [122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
>         at org.apache.brooklyn.util.core.task.BasicExecutionManager$SubmissionCallable.call(BasicExecutionManager.java:565) [122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at org.apache.brooklyn.util.core.task.SingleThreadedScheduler$1.call(SingleThreadedScheduler.java:116) [122:org.apache.brooklyn.core:1.0.0.SNAPSHOT]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
>         at java.lang.Thread.run(Thread.java:748) [?:?]
> {noformat}
> The child entity's persisted state has {{<systemload.average>0.36</systemload.average>}}, but the value {{0.36}} is of type string.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)