Solutions
ForgeRock Identity Platform
Does not apply to Identity Cloud

Building from source fails with The exception was thrown with the wrong message when system locale is not English

Last updated Feb 23, 2023

The purpose of this article is to provide assistance if building from source using Apache Maven™ fails with the following exception when the system locale is not English: "FAILURE! org.testng.TestException: The exception was thrown with the wrong message". This article applies to all ForgeRock products (AM, Agents, DS, IDM and IG).


Warning

ForgeRock support covers the use of the official binary builds made available and downloaded from our customer portal: Backstage. We will support builds made from source providing no changes have been made to the core code of the product, the product was built from a tag that matches an official release, for example, 6 and said product was built using the ForgeRock build scripts provided as part of the source. In the event that a customer experiences an issue with a ForgeRock product built from source where ForgeRock believe the issue is as a result of the build process, ForgeRock reserves the right to ask the customer to attempt to reproduce the issue on an official ForgeRock binary build. Customers who are running custom builds or who need further clarification should contact their ForgeRock sales representative.

Symptoms

The Maven build fails and you see a message similar to the following, where the English message is shown followed by the equivalent in a different language:

  • French example: ------------------------------------------------------- T E S T S  -------------------------------------------------------  Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=96m; support was removed in 8.0  Running TestSuite  Tests run: 170, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.3 sec <<< FAILURE! - in TestSuite  shouldForbidChangingIntegerCache(org.forgerock.openam.scripting.StandardScriptEvaluatorTest) Time elapsed: 0.081 sec <<< FAILURE!  org.testng.TestException:  The exception was thrown with the wrong message: expected ".*Access to Java class .*? is prohibited.*" but got "L'accès à la classe Java "java.lang.Class" est prohibé. (<Unknown source>#1) in <Unknown source> at line number 1 at column number 0"
  • Spanish example: ------------------------------------------------------- T E S T S  -------------------------------------------------------  Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=96m; support was removed in 8.0  Running TestSuite  Tests run: 170, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.3 sec <<< FAILURE! - in TestSuite  shouldForbidChangingIntegerCache(org.forgerock.openam.scripting.StandardScriptEvaluatorTest) Time elapsed: 0.081 sec <<< FAILURE!  org.testng.TestException:  The exception was thrown with the wrong message: expected "Invalid value DELETE for property actionValues" but got "Valor no válido DELETE para propiedad actionValues"

Recent Changes

Changed the system locale to a non-English locale.

Causes

Some error messages are hard-coded in English. When Maven attempts to display them in a different language (as determined by your system locale), it fails and generates this exception.

Solution

This issue can be resolved using one of the following approaches:

  • Exclude the unit tests when building from source. This can be achieved using the following command: $ mvn install -DskipTests
  • Add the -Duser.language=en option to the root pom.xml file and rebuild. This option should be added to the java.surefire.options property. For example: <java.surefire.options>-Xms256m -Xmx256m -XX:MaxPermSize=96m -Duser.language=en</java.surefire.options>

See Also

Source code in ForgeRock products

Related Training

N/A

Related Issue Tracker IDs

N/A


Copyright and Trademarks Copyright © 2023 ForgeRock, all rights reserved.