Uploaded image for project: 'OpenAM'
  1. OpenAM
  2. OPENAM-17830

Error messages are logged when the Push Notification Service is absent

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 7.0.0, 7.1.0
    • 2021.6, 7.0.3, 7.2.0
    • None
    • None
    • local AM with embedded DS
    • Rank:
      1|i04lo6:

    Description

      Bug description

      Some requests cause AM to log an error message stating that Realm configuration is missing for the Push Notification Service. For example, the following appears when AM is configured for the first time:

      ERROR: Unable to retrieve instance of the ServiceConfig for realm /.
      

      Messages such as these have been observed in a number of Jira issues and this behaviour has also been logged in a customer ticket.

      How to reproduce the issue

      1. Build AM 7.0.x or later
      2. Deploy AM
      3. Set up AM with the default configuration (embedded DS)
      4. Inspect the debug log file am_base_path/openam/var/debug/Push
      Expected behaviour
      No ERROR level messages when there is no PNS configured
      
      Current behaviour
      Messages including stacktraces are logged
      

      Work around

      Configuring a PNS will stop the messages

      Code analysis

      See https://stash.forgerock.org/projects/OPENAM/repos/openam/pull-requests/10095/diff#openam-push-notification/src/main/java/org/forgerock/openam/services/push/PushNotificationServiceConfigHelperFactory.java

      PushNotificationServiceConfigHelperFactory #getConfigHelperFor()
             try {
                  Optional<PushNotificationServiceConfig.Realm> serviceConfig = serviceConfigRegistry.getRealmSingleton(
                          PushNotificationServiceConfig.Realm.class, Realms.of(realm));
                  return new PushNotificationServiceConfigHelper(serviceConfig.get());
              } catch (RealmLookupException | ServiceConfigException | NoSuchElementException e) {
                  debug.error("Unable to retrieve instance of the ServiceConfig for realm {}.", realm);
                  throw new SMSException("Unable to retrieve instance of the ServiceConfig.");
              }
      

      The above code logs an error and throws an Exception when the SMS config (service instance) is not present (leading to a NoSuchElementException).

      The following scenarios will cause errors or warnings to be logged:

      1. Configuring AM (setting up the servlet)
      2. Deleting a Push Notification Service
      3. Changing the organization defaults for any realm that does not have a Push Notification Service

      Attachments

        Issue Links

          Activity

            People

              mark.leonard Mark Leonard
              mark.leonard Mark Leonard
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: