I'm running a Java EE application which uses Hibernate 5.2.10.Final with an Apache Derby storage backend on Payara 4.1.1.172. I'm seeing error messages like
Caused by: java.sql.SQLDataException: A truncation error was encountered trying to shrink VARCHAR () FOR BIT DATA '(Binärer Datenwert wird nicht angezeigt)' to length 255.
which indicates that either Hibernate or Derby or both are not using english error messages in all parts of the message.
I tried to
add a
static { System.setProperty("user.language", "en"); System.setProperty("user.region", "en_US"); }
to a class, but I don't seem to find a deterministic way to get this loaded before any exception occurs and I'd rather like to keep the setting out of the code. The same thus applies to
Locale.setDefault
.- specify
-Duser.language=en
in the Payara JVM options ofserver-config
as describe at How to enable assertion for a Java EE project in NetBeans?
I see that the beginning of the exception message is in English. I want the complete message to be in English including all possible parts. I'm not interesting in solving the exception, it's an example. I'm not looking for a translation of the German part of the message.
The non-English message part is most likely caused by the German Ubuntu 18.04 the server is started on. Changing the system locale of the OS or a container the server could be wrapped into is a workaround, but not a solution.
A SSCCE can be found at https://gitlab.com/krichter/derby-embedded-data-source-locale-j4ee and example output of the CI at https://gitlab.com/krichter/derby-embedded-data-source-locale-j4ee/-/jobs/83525395. The SSCCE only contains boilerplate around the server start and a simple invalid native query causing a german error message, not more information than provided in the question.
Please verify answers with the SSCCE if possible.
My motivation is to have English exception messages in order to make finding solution through search engines easier during development without tampering with the system language.