Solutions

Guice configuration errors when importing or exporting policies using ssoadm in AM 5, 5.1.x and OpenAM 13.5.1

Last updated Jan 4, 2019

The purpose of this article is to provide assistance if you receive an "Exception in thread "main" com.google.inject.ConfigurationException: Guice configuration errors" response when using the export-policy or import-policy ssoadm commands in AM/OpenAM.


Symptoms

Using the export-policy or import-policy ssoadm command fails with the following exception:

Exception in thread "main" com.google.inject.ConfigurationException: Guice configuration errors:

1) Could not find a suitable constructor in org.forgerock.http.Client. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
   at org.forgerock.http.Client.class(Unknown Source)
   while locating org.forgerock.http.Client
     for parameter 0 at org.forgerock.openam.cli.entitlement.PolicyExport.<init>(Unknown Source)
   while locating org.forgerock.openam.cli.entitlement.PolicyExport

1 error
   at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1004)
   at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:961)
   at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:  
   at org.forgerock.guice.core.InjectorHolder.getInstance(InjectorHolder.java:72)
   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:581)
   at com.sun.identity.cli.CommandManager.<init>(CommandManager.java:178)
   at com.sun.identity.cli.CommandManager.main(CommandManager.java:155)

This occurs when you use a command such as the following:

$ ./ssoadm policy-export -e / -u amadmin -f pwd.txt -s "http://host1.example.com:8080/openam" -J policy.json

Recent Changes

Upgraded to, or installed AM 5 or 5.1.x.

Upgraded to, or installed OpenAM 13.5.1.

Causes

Recent changes to resolve OPENAM-9749 (Resource leak in ssoadm's audit logging) have caused this issue with exporting and importing policies via ssoadm.

Solution

This issue can be resolved by upgrading to OpenAM 13.5.2, or AM 5.5 and later; you can download this from BackStage.

Workaround

You can workaround this issue as follows depending on your version:

AM 5 and 5.1.x

You can use Amster or REST to export and import policies. For example, you would use the following command to export with Amster:

am> export-config --path /path/to/export --realm / --realmEntities 'Policies'

See Authorization Guide › Importing and Exporting XACML 3.0 for further information on using REST.

OpenAM 13.5.1

You can install and use the ssoadm tool from OpenAM 13.5 or you can use REST to export and import policies.

See Developer's Guide › Importing and Exporting XACML 3.0 for further information on using REST.

See Also

How do I export and import policies in AM/OpenAM (All versions)?

create-realm ssoadm command fails in AM 5 with Guice configuration errors

Amster User Guide > Exporting Configuration Data

Amster User Guide > Importing Configuration Data

Related Training

N/A

Related Issue Tracker IDs

OPENAM-11584 (Ssoadm policy-import throws Guice error)

OPENAM-9749 (Resource leak in ssoadm's audit logging)



Copyright and TrademarksCopyright © 2019 ForgeRock, all rights reserved.
Loading...