You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/04/13 16:47:41 UTC

[jira] [Commented] (BROOKLYN-474) Rebind failed for historic ZooKeeperEnsembleImpl$MemberTrackingPolicy (no-arg constructor not accessible)

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

ASF GitHub Bot commented on BROOKLYN-474:
-----------------------------------------

GitHub user aledsage opened a pull request:

    https://github.com/apache/brooklyn-server/pull/634

    BROOKLYN-474: rebind to policy with private constructor

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/aledsage/brooklyn-server BROOKLYN-474

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/brooklyn-server/pull/634.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #634
    
----
commit 8e314a986465923365ea640efd86f936acab3bfc
Author: Aled Sage <al...@gmail.com>
Date:   2017-04-13T16:46:33Z

    BROOKLYN-474: rebind to policy with private constructor

----


> Rebind failed for historic ZooKeeperEnsembleImpl$MemberTrackingPolicy (no-arg constructor not accessible)
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: BROOKLYN-474
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-474
>             Project: Brooklyn
>          Issue Type: Bug
>            Reporter: Aled Sage
>
> When testing rebind with 0.11.0 RC1 against historic persisted state, we saw the exception below:
> {noformat}
> Caused by: org.apache.brooklyn.util.exceptions.CompoundRuntimeException: Failure rebinding; 2 errors including: problem creating POLICY lplpmv3goo of type org.apache.brooklyn.entity.zookeeper.ZooKeeperEnsembleImpl$MemberTrackingPolicy: Cannot instantiate instance of type class org.apache.brooklyn.entity.zookeeper.ZooKeeperEnsembleImpl$MemberTrackingPolicy; expected constructor signature not found (args are [{id=lplpmv3goo, deferConstructionChecks=true, noConstructionInit=true, group=ZooKeeperEnsembleImpl{id=stkwkmp76w}, uniqueTag=MemberTrackingPolicy:ZooKeeperEnsembleImpl{id=stkwkmp76w}, tags=[]}])
>         at org.apache.brooklyn.util.exceptions.Exceptions.create(Exceptions.java:474)[141:org.apache.brooklyn.utils-common:0.11.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindExceptionHandlerImpl.onDoneImpl(RebindExceptionHandlerImpl.java:498)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindExceptionHandlerImpl.onDone(RebindExceptionHandlerImpl.java:414)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.run(RebindIteration.java:267)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl.rebindImpl(RebindManagerImpl.java:560)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl$3.call(RebindManagerImpl.java:510)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl$3.call(RebindManagerImpl.java:508)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         at org.apache.brooklyn.util.core.task.BasicExecutionManager$SubmissionCallable.call(BasicExecutionManager.java:529)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         ... 4 more
> Caused by: java.lang.IllegalStateException: problem creating POLICY lplpmv3goo of type org.apache.brooklyn.entity.zookeeper.ZooKeeperEnsembleImpl$MemberTrackingPolicy
>         at org.apache.brooklyn.core.mgmt.rebind.RebindExceptionHandlerImpl.onCreateFailed(RebindExceptionHandlerImpl.java:265)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.instantiateAdjuncts(RebindIteration.java:484)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.doRun(RebindIteration.java:241)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.InitialFullRebindIteration.doRun(InitialFullRebindIteration.java:69)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.run(RebindIteration.java:265)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         ... 8 more
> Caused by: java.lang.IllegalStateException: Cannot instantiate instance of type class org.apache.brooklyn.entity.zookeeper.ZooKeeperEnsembleImpl$MemberTrackingPolicy; expected constructor signature not found (args are [{id=lplpmv3goo, deferConstructionChecks=true, noConstructionInit=true, group=ZooKeeperEnsembleImpl{id=stkwkmp76w}, uniqueTag=MemberTrackingPolicy:ZooKeeperEnsembleImpl{id=stkwkmp76w}, tags=[]}])
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration$BrooklynObjectInstantiator.invokeConstructor(RebindIteration.java:1157)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration$BrooklynObjectInstantiator.newPolicy(RebindIteration.java:1061)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.instantiateAdjuncts(RebindIteration.java:481)[120:org.apache.brooklyn.core:0.11.0.SNAPSHOT]
>         ... 11 more
> {noformat}
> The problem is that persisted state refers to an instance of {{org.apache.brooklyn.entity.zookeeper.ZooKeeperEnsembleImpl$MemberTrackingPolicy}}, which has since been made a private class. The no-arg constructor is therefore not directly accessible, which leads us down the wrong code path.
> The generalise advice would be to ensure that the class for anything in persisted state has a public no-arg constructor.
> A general fix would be to use {{getDeclaredConsturctor(new Class[0])}} (so we get the private constructor), and then to call the constructor after doing {{constructor.setAccessible(true)}}.
> We should also add a public no-arg constructors to {{ZooKeeperEnsembleImpl$MemberTrackingPolicy}} (which only exists for backwards compatibility).



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)