Guice creation errors when importing service configurations using ssoadm in AM 5.x and OpenAM 13.5.1
The purpose of this article is to provide assistance if you receive a "com.google.inject.CreationException: Guice creation errors" response when using the import-svc-cfg ssoadm command in AM/OpenAM. Alternatively, you may see "An registered exception occurred. Please see log for further details." response instead.
Archived
This article has been archived and is no longer maintained by ForgeRock.
Symptoms
Using the import-svc-cfg ssoadm command fails with one of the following responses:
- com.google.inject.CreationException: Guice creation errors: com.google.inject.CreationException: Guice creation errors: 1) No implementation for javax.servlet.ServletContext annotated with @com.google.inject.name.Named(value=servletContext) was bound. while locating javax.servlet.ServletContext annotated with @com.google.inject.name.Named(value=servletContext) for parameter 0 at org.forgerock.openam.services.baseurl.BaseURLProviderFactory.<init>(Unknown Source) while locating org.forgerock.openam.services.baseurl.BaseURLProviderFactory for parameter 1 at org.forgerock.openam.http.OpenAMHttpApplication.<init>(Unknown Source) at org.forgerock.openam.http.HttpGuiceModule.configure(HttpGuiceModule.java:35) 1 error at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435) at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:154) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106) at com.google.inject.Guice.createInjector(Guice.java:95) at org.forgerock.guice.core.GuiceInjectorCreator.createInjector(GuiceInjectorCreator.java:33) at org.forgerock.guice.core.InjectorFactory.createInjector(InjectorFactory.java:63) at org.forgerock.guice.core.InjectorHolder.<init>(InjectorHolder.java:49) at org.forgerock.guice.core.InjectorHolder.<clinit>(InjectorHolder.java:37) at com.sun.identity.cli.SubCommand.execute(SubCommand.java:295) at com.sun.identity.cli.CLIRequest.process(CLIRequest.java:217) at com.sun.identity.cli.CLIRequest.process(CLIRequest.java:139) at com.sun.identity.cli.CommandManager.serviceRequestQueue(CommandManager.java:583) at com.sun.identity.cli.CommandManager.<init>(CommandManager.java:180) at com.sun.identity.cli.CommandManager.main(CommandManager.java:157)
- An registered exception occurred. Please see log for further details: Process Request ... Constructing Request Context... Validating mandatory options... Processing Sub Command ... Executing class, com.sun.identity.cli.schema.ImportServiceConfiguration. Connecting to directory server. Connected to directory server. com.sun.identity.cli.CLIException: An registered exception occurred. Please see log for further details. at com.sun.identity.cli.schema.ImportServiceConfiguration.handleRequest(ImportServiceConfiguration.java:153) at com.sun.identity.cli.SubCommand.execute(SubCommand.java:296) at com.sun.identity.cli.CLIRequest.process(CLIRequest.java:217) at com.sun.identity.cli.CLIRequest.process(CLIRequest.java:139) at com.sun.identity.cli.CommandManager.serviceRequestQueue(CommandManager.java:578) at com.sun.identity.cli.CommandManager.<init>(CommandManager.java:175) at com.sun.identity.cli.CommandManager.main(CommandManager.java:152) An registered exception occurred. Please see log for further details.
This occurs when you use a command such as the following:
$ ./ssoadm import-svc-cfg -u amadmin -f pwd.txt -e secretkey -X Config.xmlRecent Changes
Upgraded to, or installed AM 5.x.
Upgraded to, or installed OpenAM 13.5.1.
Causes
Recent changes to resolve OPENAM-10562 (Audit log 'Configuration' entries are not written when using external configuration store) introduced a reliance on Guice to get the Auditor module. ssoadm has not been updated to use this code, which prevents service configurations being imported.
Solution
This issue can be resolved by upgrading to OpenAM 13.5.2, or AM 6 or later; you can download this from BackStage.
Workaround
You can workaround this issue as follows depending on your version:
AM 5.x
Note
You cannot use Amster to import the XML that was exported using the ssoadm command. The service configuration in AM 5.x is stored in JSON format and unfortunately, they are not interchangeable.
You can use the following Amster commands to export and then import your service configuration:
For example, you would use the following command to export with Amster:
am> export-config --path /path/to/exportedFilesSee Exporting Configuration Data and Importing Configuration Data for a complete list of options.
OpenAM 13.5.1
You can install and use the ssoadm tool from OpenAM 13.5.0 to import service configurations.
See Also
How do I export and import Service configurations for AM (All versions) using Amster or ssoadm?
create-realm ssoadm command fails in AM 5 with Guice configuration errors
Related Training
N/A
Related Issue Tracker IDs
OPENAM-11607 (ssoadm import-svc-cfg fails with Guice errors)