应用程序可以保留用户,以后可以对其进行修改。最近无法修改用户,并且引发了HV000028
异常。用户实体被持久保存,没有错误或验证。
有人知道导致这种行为的原因是什么,或者我如何找到更多细节?
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) Caused by: javax.validation.ValidationException: HV000028: Unexpected exception during isValid call.
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:451)
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:127)
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:87)
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:73)
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraint(ValidatorImpl.java:592)
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:555)
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:490)
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:454)
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:406)
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:204)
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:253)
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at sun.reflect.GeneratedMethodAccessor427.invoke(Unknown Source)
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2018-06-29 13:40:29,612 INFO [stdout] (default task-48) at java.lang.reflect.Method.invoke(Method.java:498)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:507)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) at com.sun.proxy.$Proxy287.validate(Unknown Source)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) at ch.lmv.ulm.web.page.template.BasePanel.doCompleteJSR303Validation(BasePanel.java:65)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) at ch.lmv.ulm.web.page.template.BasePanel.doCompleteJSR303Validation(BasePanel.java:49)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) at ch.lmv.ulm.web.page.person.EditPersonPanel$7.onSubmit(EditPersonPanel.java:420)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) at org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink$1.onSubmit(AjaxSubmitLink.java:110)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$AjaxFormSubmitter.onSubmit(AjaxFormSubmitBehavior.java:215)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1307)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) at org.apache.wicket.markup.html.form.Form.process(Form.java:974)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:795)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:171)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:155)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:588)
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) ... 82 more
2018-06-29 13:40:29,613 INFO [stdout] (default task-48) Caused by: java.lang.NullPointerException
答案 0 :(得分:1)
从堆栈跟踪中,验证在某些NullPointerException上失败,但是在最后一行。您应该已经发布了完整的堆栈跟踪。
还请注意,不是引发异常的Hibernate(ORM),而是完全不同的Hibernate Validator。
此验证器对从检票口调用的输入对象执行一系列验证,请参阅:ch.lmv.ulm.web.page.template.BasePanel.doCompleteJSR303Validation
。
现在,最糟糕的是您的日志记录系统可能配置不正确。很难说出日志系统到底发生了什么,因为您没有提供任何详细信息。
在正确的配置中,具有堆栈跟踪的异常应该打印为多行字符串(一个INFO消息),而不是一系列消息(每行都有INFO,这是错误的)。 / p>
调用日志的正确方法(例如在slf4j框架中)应为:
try {
... execute validation code
}catch (<SomeKindOfValidationExceptionYouExpectToGet> ex) {
logger.error("Failed to validate <or better message>", ex);
}
请注意,您在此处将异常作为附加参数传递。
答案 1 :(得分:0)
容易,这是因为用户已经在带有@NotNull
批注的网页表单中提交了一些值,并且在传入请求的验证器中,当您检测到无效的null
时,某些NPE是在Spring可以抛出自己的InvalidArgumentException
之前,在验证过程中抛出。
最重要的是,告诉用户更改其输入,并更改代码以引发InvalidArgumentException
,以便异常处理程序可以完成其工作。