2

I have a problem regarding the localization of custom bean validation exceptions like ConstraintViolationException that are thrown at remote EJB Beans.

The JSF web application uses german locale and calls remote EJB Beans of an EAR that runs at englisch default locale. When a bean validation exceptions is thrown they are created using english locale.

Is there a way to pass the client locale to the remote bean (transaction) like defining it in JNDI lookup?

At client I extract the messages like:

final ConstraintViolationException cve = (ConstraintViolationException) e;

for (final ConstraintViolation<?> cv : cve.getConstraintViolations())
    context.addMessage(null, FacesMessageUtils.getMessage(context, FacesMessage.SEVERITY_ERROR, cv.getMessage()));
djmj
  • 5,579
  • 5
  • 54
  • 92
  • This will strongly depend on how you have separated your modules, and which server you are using: http://stackoverflow.com/questions/25247689/pass-default-application-context-to-remote-ejb-anonymously – maress Jun 18 '15 at 21:37
  • Thanks for the link. Will investigate the Interceptor option when i have more time. – djmj Jun 21 '15 at 18:13
  • I posted an possible answer here: https://stackoverflow.com/questions/23085247/how-to-set-locale-in-bean-validation/44686346#44686346 – djmj Jun 21 '17 at 21:17

0 Answers0