Opening the Users view within the admin console results in a NullPointerException

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server と Data Center のみ - この記事は、サーバーおよびデータセンター プラットフォームのアトラシアン製品にのみ適用されます。

問題

When an administrator opens the View All Users page, Confluence displays a NullPointerException to the UI and records an error in the application log. 

Examples of this include the following:

2016-02-01 10:04:31,955 ERROR [http-nio-80-exec-5] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action
 -- referer: http://URL/admin/users/showallusers.action?reset=true | url: /admin/users/showallusers.action | userName: admin007
java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187)
	at com.google.common.collect.ImmutableList$Builder.add(ImmutableList.java:583)
	at com.google.common.collect.ImmutableList$Builder.add(ImmutableList.java:566)
	at com.google.common.collect.ImmutableCollection$Builder.addAll(ImmutableCollection.java:324)
	at com.google.common.collect.ImmutableList$Builder.addAll(ImmutableList.java:600)
	at com.atlassian.confluence.api.model.pagination.PageResponseImpl$Builder.addAll(PageResponseImpl.java:189)
	at com.atlassian.confluence.api.model.pagination.PageResponseImpl.from(PageResponseImpl.java:94)
	at com.atlassian.confluence.api.impl.pagination.PaginationServiceImpl.lambda$doRequestInTransaction$385(PaginationServiceImpl.java:146)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
	at com.atlassian.confluence.api.impl.pagination.PaginationServiceImpl.doRequestInTransaction(PaginationServiceImpl.java:141)
	at com.atlassian.confluence.api.impl.pagination.PaginationServiceImpl.doPaginationRequest(PaginationServiceImpl.java:63)
	at com.atlassian.confluence.internal.user.UserSearchServiceInternalImpl.doUserSearch(UserSearchServiceInternalImpl.java:76)
	at com.atlassian.confluence.user.actions.AbstractSearchCrowdUsersAction.doUserSearch(AbstractSearchCrowdUsersAction.java:109)
	at com.atlassian.confluence.user.actions.BrowseUsersAction.execute(BrowseUsersAction.java:11)
...
2017-01-20 09:00:30,672 ERROR [http-nio-8090-exec-270] [atlassian.confluence.servlet.ConfluenceServletDispatcher] sendError Could not execute action
 -- referer: https://confluence.test.com/admin/plugins/lucidchart/configure.action | url: /admin/plugins/lucidchart/users.action | traceId: 42b48931e6993fdb | userName: admin007
java.lang.NullPointerException: Unable to find user mapping for test_user
    at com.atlassian.confluence.user.DefaultPersonalInformationManager.getOrCreatePersonalInformation(DefaultPersonalInformationManager.java:66)
    at com.atlassian.confluence.user.DefaultPersonalInformationManager.getPersonalInformation(DefaultPersonalInformationManager.java:54)
    at sun.reflect.GeneratedMethodAccessor2980.invoke(Unknown Source)

原因

This issue occurs when there's a missing or incomplete user record within the USER_MAPPING table.  This situation can occur for any number of reasons:

  • A corruption in a cache.  Example:  CONFSERVER-56037 - Getting issue details... STATUS
  • A corruption in an index. 
  • A corruption involving an external user directory.
  • A corruption at the database level.

診断

To find the record(s) causing this issue, let's first confirm whether there are any null values or inconsistent values within the USER_MAPPING table:



Diagnosis SQL queries
SELECT * FROM user_mapping WHERE username IS NULL OR lower_username IS NULL OR lower_username NOT LIKE lower(username); 

If any records return, execute the appropriate SQL Update command to populate the missing or inconsistent value.   If help is needed with this, please open a ticket with the Atlassian Support team.


If no records return, let's then check that every user in the CWD_USER table has a corresponding entry within the USER_MAPPING table and that there are no null values for username in the CWD_USER table:

SELECT * FROM cwd_user WHERE user_name not in (select username from user_mapping);
SELECT * FROM cwd_user WHERE lower_user_name not in (select lower_username from user_mapping);
SELECT * FROM cwd_user WHERE user_name is null or lower_user_name is null;

ソリューション  

If the queries above don't return any results, then try clearing the Confluence Cache Statistics and/or re-indexing: 

  1. First, try flushing the Cache Statistics: 
    1. Click on  >  General Configuration > Cache Management
    2. On the resulting page, click the Flush All button.
  2. If the problem persists, rebuild the indexes from within the UI:
    1. Click on  >  General Configuration > Content Indexing.
    2. Click Rebuild button.
  3. If the problem still occurs, then rebuild the content indexes from scratch.  (warning) Please note, since a restart of Confluence is required, we recommend performing these steps either during a scheduled maintenance window or after hours to avoid impact to end users.

If records do return from the second query above in which there were missing user in the USER_MAPPING table, then proceed as follows depending on the kind of directory in use for user management.

If an external LDAP directory is utilized and the connector for this service is configured with:

  •  Read only or Read/Write, then follow these steps:
    • (info) By default, the Jira user directory will not allow local groups within Confluence. These same instructions will work with the  external Jira user directory.
  1. Create a backup of the Confluence database.
  2. If you haven't already done so, log into Confluence as a admin user from the Internal Directory.
  3. Click on  >  General Configuration > User Directories
  4. Locate the directory for the user who has a missing USER_MAPPING table entry.
  5. Note the configuration of this directory's connector; this can be done by manually noting its settings or taking screen shots of the configuration.
  6. Disable the directory in question and then remove it.  (info) This will cause Confluence to remove user entries for that directory from both the CWD_USER and USER_MAPPING tables.
  7. Create a new directory connector using the same directory configuration as noted in the previous step.  (info) This will cause Confluence to re-insert users into both the CWD_USER and USER_MAPPING tables.
  8. Now, test the Users page to check if it renders as expected.

If an Internal Directory is utilized and the user in question belongs to this directory:

  1. Create a backup of the Confluence database.
  2. Shut down Confluence.
  3. For each affected user, insert values manually into the database: 

    INSERT INTO user_mapping values ('2c9681954172cf560000000000000001', 'test_user', 'test_user');
    INSERT INTO content ("contentid", "contenttype", "version", "content_status", "username") VALUES (9999999, 'USERINFO', 1, 'current', '2c9681954172cf560000000000000001');

    (info) For each user returned from the diagnostic query, replace the "test_user" values with the user's username.  Also, be sure to use a unique user_key value for each inserted record (eg. '2c9681954172cf560000000000000001')

  4. Confluence を再起動します。


最終更新日 2021 年 7 月 12 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.