Skip to content

Bean validation doesn't work on OpenLiberty #398

@mthmulders

Description

@mthmulders

I've got a minimal MVC / Krazo application set up with a form to enter some information. That information should be validated before being processed.

You can start the app with mvn liberty:dev - after that, go to http://localhost:9080/, click "Persons", click "Add". Enter a name and an age below 18. After hitting "Save", the user should see the form again, with some error information, but instead, the user sees a 400 response ("bad request"). In the OpenLiberty log, this message appears

[WARNING ] save.person.age: must be greater than or equal to 18

This at least contradicts expectations :-) but more importantly it contradicts @ivargrimstad's answer to my question in #397.

My first impression is that probably, the "standard" bean validation mechanism in Jakarta RESTful Web Services kicks in "too early", preventing Krazo's ValidationInterceptor from being invoked. I had a few breakpoints in that class and they are hit when I do a "GET" retrieve the form (but obviously, all's good then), but they do not get hit when I do the "POST" with invalid data.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions