New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotNull validation of BaseReporterFactory.frequency fails #1308

Closed
evnm opened this Issue Oct 28, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@evnm
Member

evnm commented Oct 28, 2015

Upon upgrading to Dropwizard 0.9.0, the db migrate task of an application I maintain failed with the following output:

Exception in thread "main" javax.validation.UnexpectedTypeException: HV000186: The constraint of type 'javax.validation.constraints.NotNull' defined on 'metrics.reporters[0].frequency' has multiple matching constraint validators which is due to an additional value handler of type 'io.dropwizard.validation.valuehandling.OptionalValidatedValueUnwrapper'. It is unclear which value needs validating. Clarify configuration via @UnwrapValidatedValue.
    at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getConstraintValidatorInstanceForAutomaticUnwrapping(ConstraintTree.java:266)
    at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getInitializedConstraintValidator(ConstraintTree.java:163)
    at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:116)
    at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:87)
    at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:73)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraint(ValidatorImpl.java:592)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:555)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:490)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:454)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:406)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraint(ValidatorImpl.java:770)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraints(ValidatorImpl.java:656)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:415)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraint(ValidatorImpl.java:770)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraints(ValidatorImpl.java:656)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:415)
    at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:204)
    at io.dropwizard.configuration.ConfigurationFactory.validate(ConfigurationFactory.java:257)
    at io.dropwizard.configuration.ConfigurationFactory.build(ConfigurationFactory.java:149)
    at io.dropwizard.configuration.ConfigurationFactory.build(ConfigurationFactory.java:95)
    at io.dropwizard.cli.ConfiguredCommand.parseConfiguration(ConfiguredCommand.java:115)
    at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:64)
    at io.dropwizard.cli.Cli.run(Cli.java:70)
    at io.dropwizard.Application.run(Application.java:80)
    at com.whiskerlabs.aphid.AphidApplication.main(AphidApplication.java:50)

The ReporterFactory in play is DatadogReporterFactory from the dropwizard-metrics-datadog package. Following the lede of this refreshingly-helpful exception message, I tried adding a @UnwrapValidatedValue(false) annotation to the BaseReporterFactory.frequency field, which fixed the issue. With a patched dropwizard-metrics artifact, my application's db migrate task works.

@nickbabcock

This comment has been minimized.

Show comment
Hide comment
@nickbabcock

nickbabcock Oct 28, 2015

Contributor

Closed by #1309

Contributor

nickbabcock commented Oct 28, 2015

Closed by #1309

@evnm

This comment has been minimized.

Show comment
Hide comment
@evnm

evnm Oct 28, 2015

Member

Thanks for the quick turnaround time!

Member

evnm commented Oct 28, 2015

Thanks for the quick turnaround time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment