You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by "Valentin Aitken (JIRA)" <ji...@apache.org> on 2015/11/13 10:46:10 UTC

[jira] [Updated] (BROOKLYN-193) Rebind failure: Cannot coerce or set value

     [ https://issues.apache.org/jira/browse/BROOKLYN-193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Valentin Aitken updated BROOKLYN-193:
-------------------------------------
    Description: 
*Use case*
If you submit a blueprint with a value of invalid type it is accepted.
This causes writing invalid data to persistence and which leads to a failure on rebind.

*Steps to reproduce: *
# Submit a blueprint with a Map value where string value is expected.
Enter a {color:red}wrong BP{color}
{code}
location: aws-centos6
services:
- type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
  java.sysprops:
    test: false
    provisioning.properties:
      minRam: 4
      minHdd: 100
{code}
Instead of {color:green}a correct one{color}
{code}
location: aws-centos6
services:
- type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
  java.sysprops:
    test: false
  provisioning.properties:
    minRam: 4
    minHdd: 100
{code}
# Let's say that by mistake you nest provisioning.properties into java.sysprops (java.sysprops is Map<String, String>)
# The blueprint is accepted and deployed successfully.
# Restart Apache Brooklyn
# A startup error occurs
{code:none}
java.lang.IllegalArgumentException: Cannot coerce or set' 
2015-11-13 11:16:50,305 WARN  Rebind: continuing after problem rebinding entity oisgTyDZ (TomcatServerImpl{id=oisgTyDZ})
java.lang.IllegalArgumentException: Cannot coerce or set {minRam=4, minHdd=100} to java.sysprops.provisioning.properties[ConfigKey:java.lang.String]
	at org.apache.brooklyn.core.config.internal.AbstractConfigMapImpl.coerceConfigVal(AbstractConfigMapImpl.java:83) ~[classes/:na]
Caused by: org.apache.brooklyn.util.core.flags.ClassCoercionException: Cannot coerce type class com.google.common.collect.Maps$TransformedEntriesMap to java.lang.String ({minRam=4, minHdd=100}): no adapter known
	at org.apache.brooklyn.util.core.flags.TypeCoercions.coerce(TypeCoercions.java:272) ~[classes/:na]
{code}

*Short-term workaround*
The persisted state for the relevant entities can be modified to remove the incorrect configuration value.

*The steps to do this are: *

    # stop Apache Brooklyn.
    # backup your existing persisted state.
    # replace the relevant files with those attached.
    # start Apache Brooklyn.

*Long-term solution*
We are looking at improvements to Apache Brooklyn: to allow rebind, even when there are configuration errors like this (e.g. where the invalid configuration value is dropped).

  was:
*Use case*
If you submit a blueprint with a value of invalid type it is accepted.
This causes writing invalid data to persistence and which leads to a failure on rebind.

*Steps to reproduce: *
# Submit a blueprint with a Map value where string value is expected.
Enter a {color:red}wrong BP{color}
{code}
location: aws-centos6
services:
- type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
  java.sysprops:
    test: false
    provisioning.properties:
      minRam: 4
      minHdd: 100
{code}
Instead of {color:green}a correct one{color}
{code}
location: aws-centos6
services:
- type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
  java.sysprops:
    test: false
  provisioning.properties:
    minRam: 4
    minHdd: 100
{code}
# Let's say that by mistake you nest provisioning.properties into java.sysprops (java.sysprops is Map<String, String>)
# The blueprint is accepted and deployed successfully.
# Restart Apache Brooklyn
# A startup error occurs
{code:none}
java.lang.IllegalArgumentException: Cannot coerce or set' 
2015-11-13 11:16:50,305 WARN  Rebind: continuing after problem rebinding entity oisgTyDZ (TomcatServerImpl{id=oisgTyDZ})
java.lang.IllegalArgumentException: Cannot coerce or set {minRam=4, minHdd=100} to java.sysprops.provisioning.properties[ConfigKey:java.lang.String]
	at org.apache.brooklyn.core.config.internal.AbstractConfigMapImpl.coerceConfigVal(AbstractConfigMapImpl.java:83) ~[classes/:na]
Caused by: org.apache.brooklyn.util.core.flags.ClassCoercionException: Cannot coerce type class com.google.common.collect.Maps$TransformedEntriesMap to java.lang.String ({minRam=4, minHdd=100}): no adapter known
	at org.apache.brooklyn.util.core.flags.TypeCoercions.coerce(TypeCoercions.java:272) ~[classes/:na]
{code}

*Short-term workaround*
The persisted state for the relevant entities can be modified to remove the incorrect configuration value. See attached for the new files, and a file showing the diff.

*The steps to do this are: *

    # stop Apache Brooklyn.
    # backup your existing persisted state.
    # replace the relevant files with those attached.
    # start Apache Brooklyn.

*Long-term solution*
We are looking at improvements to Apache Brooklyn: to allow rebind, even when there are configuration errors like this (e.g. where the invalid configuration value is dropped).


> Rebind failure: Cannot coerce or set value
> ------------------------------------------
>
>                 Key: BROOKLYN-193
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-193
>             Project: Brooklyn
>          Issue Type: Bug
>    Affects Versions: 0.8.0, 0.9.0, 1.0.0
>            Reporter: Valentin Aitken
>              Labels: starter
>
> *Use case*
> If you submit a blueprint with a value of invalid type it is accepted.
> This causes writing invalid data to persistence and which leads to a failure on rebind.
> *Steps to reproduce: *
> # Submit a blueprint with a Map value where string value is expected.
> Enter a {color:red}wrong BP{color}
> {code}
> location: aws-centos6
> services:
> - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
>   java.sysprops:
>     test: false
>     provisioning.properties:
>       minRam: 4
>       minHdd: 100
> {code}
> Instead of {color:green}a correct one{color}
> {code}
> location: aws-centos6
> services:
> - type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
>   java.sysprops:
>     test: false
>   provisioning.properties:
>     minRam: 4
>     minHdd: 100
> {code}
> # Let's say that by mistake you nest provisioning.properties into java.sysprops (java.sysprops is Map<String, String>)
> # The blueprint is accepted and deployed successfully.
> # Restart Apache Brooklyn
> # A startup error occurs
> {code:none}
> java.lang.IllegalArgumentException: Cannot coerce or set' 
> 2015-11-13 11:16:50,305 WARN  Rebind: continuing after problem rebinding entity oisgTyDZ (TomcatServerImpl{id=oisgTyDZ})
> java.lang.IllegalArgumentException: Cannot coerce or set {minRam=4, minHdd=100} to java.sysprops.provisioning.properties[ConfigKey:java.lang.String]
> 	at org.apache.brooklyn.core.config.internal.AbstractConfigMapImpl.coerceConfigVal(AbstractConfigMapImpl.java:83) ~[classes/:na]
> Caused by: org.apache.brooklyn.util.core.flags.ClassCoercionException: Cannot coerce type class com.google.common.collect.Maps$TransformedEntriesMap to java.lang.String ({minRam=4, minHdd=100}): no adapter known
> 	at org.apache.brooklyn.util.core.flags.TypeCoercions.coerce(TypeCoercions.java:272) ~[classes/:na]
> {code}
> *Short-term workaround*
> The persisted state for the relevant entities can be modified to remove the incorrect configuration value.
> *The steps to do this are: *
>     # stop Apache Brooklyn.
>     # backup your existing persisted state.
>     # replace the relevant files with those attached.
>     # start Apache Brooklyn.
> *Long-term solution*
> We are looking at improvements to Apache Brooklyn: to allow rebind, even when there are configuration errors like this (e.g. where the invalid configuration value is dropped).



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