Confluence User List throws NullPointerException
Asked by Kathy Taylor:

One of our smaller Confluence servers is throwing these issues when trying to access the User list as admin. It is running 6.12.2 and is using Postgresql 9.6.

[https://confluence.atlassian.com/confkb/confluence-triggers-npe-when-a-user-tries-to-open-view-all-users-802597745.html?utm_medium=logScan\&utm_source=STP](https://confluence.atlassian.com/confkb/confluence-triggers-npe-when-a-user-tries-to-open-view-all-users-802597745.html?utm_medium=logScan&utm_source=STP)

and

[https://confluence.atlassian.com/confkb/user-list-throws-nullpointerexception-879799322.html?utm_medium=logScan\&utm_source=STP](https://confluence.atlassian.com/confkb/user-list-throws-nullpointerexception-879799322.html?utm_medium=logScan&utm_source=STP)

Following the resolution in the second article and running the query, I find that I have 6 offending users in the database.

If I try to do the INSERT INTO commands at the end of the article, it works for one, but this article is written from the perspective of 1 user offending. I have no idea what values to use for user_mapping values when you are looking at multiple users. Does anyone know what the best way to approach this is? Thanks.

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


Answers:
author: Daniel Eads
body: Hi Kathy,

For multiple users you're going to want to do separate inserts. As indicated in the article you're going to want to swap out **dummyuser01** with the actual offending username. Both statements have unique keys (that long string) that will need to be updated too.

So for your first insert, you'll do what you've got already (swapping out **dummyuser01**)

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

But then the next insert you'll need to swap out **dummyuser02** and the unique key. I've incremented the key for you in this statement to show what it would be like:

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

For the remaining users, the unique key just needs to be incremented. The second one would be ....02, then the third ...03, etc:

    2c9681954172cf560000000000000002

Let me know if you've got more questions!

Cheers,  
Daniel \| Atlassian Support

comments: author: Kathy Taylor
body: Thank you Daniel. I'll give that a go. I wasn't sure if I could just increment it like you show here. I'll try it out and see if it resolves my problem. Will report back.

Kathy


author: Kathy Taylor
body: Actually, I do have another question about the second insert into statement. I'm assuming that the "username" in that insert is just verbatim as "username". You are not substituting the name of your offending user for that field? You only substitute the dummy username in the first insert with your own user.

    INSERT INTO content ("contentid", "contenttype", "version", "content_status", "username") VALUES (9999999, 'USERINFO', 1, 'current', '2c9681954172cf560000000000000002')??


author: Kathy Taylor
body: Hi Daniel --

The first insert works fine. But the second one is giving me a duplicate key error. As though the content id 9999999 needs to be incremented as well.

confluence=# INSERT INTO content ("contentid", "contenttype", "version", "content_status", "username") VALUES (9999999, 'USERINFO', 1, 'current', '2c9681954172cf560000000000000002');  
ERROR: duplicate key value violates unique constraint "content_pkey"  
DETAIL: Key (contentid)=(9999999) already exists.

Kathy


author: Daniel Eads
body: Ah - you are 100% correct [@Kathy Taylor](/t5/user/viewprofilepage/user-id/660416) and good catch. That integer is the key for the other table you're inserting into and does need to be incremented as well.


author: Kathy Taylor
body: Thanks, Daniel. I'll try doing that then.


author: Kathy Taylor
body: [@Daniel Eads](/t5/user/viewprofilepage/user-id/1527694) Thanks for the help with this. I ended up nuking the secondary user directory that was causing the issues and the database is clean now. I will recreate the user directory next week and see how it goes. But incrementing both the contentid and user_key values worked fine.


Tags: confluence-server

server