NullPointerException in when searching for user to be added to Permission
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Problem
Bamboo is configured to use LDAP for user management.
Searching for user to be added to the Permission, will have a popup window error with the following message:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
java.lang.NullPointerException
at com.atlassian.bamboo.plugins.rest.permission.BasicPermissionResource.lambda$getAvailableUsers$1(BasicPermissionResource.java:103)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$222(StreamSpliterators.java:294)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:169)
at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300)
at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
at com.atlassian.bamboo.plugins.rest.pagination.PaginationServiceImpl.getPageResponse(PaginationServiceImpl.java:76)
at com.atlassian.bamboo.plugins.rest.pagination.PaginationServiceImpl.getPage(PaginationServiceImpl.java:36)
at com.atlassian.bamboo.plugins.rest.permission.BasicPermissionResource.getAvailableUsers(BasicPermissionResource.java:104)
at com.atlassian.bamboo.plugins.rest.permission.GlobalPermissionsResource.getAvailableUsers(GlobalPermissionsResource.java:143)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$TypeOutInvoker$1.invoke(DispatchProviderHelper.java:169)
at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$1.intercept(DispatchProviderHelper.java:83)
Diagnosis
Environment
Bamboo version 6.2.1+
Diagnostic Steps
Check what is the username attribute configured in the file
BAMBOO_HOME/xml-data/configuration/atlassian-user.xml
, for example:1 2 3 4 5 6 7 8 9 10
<ldap key="adRepository" name="AD Repository" cache="true"> <host>localhost</host> <port>389</port> <securityPrincipal>uid=admin,ou=system</securityPrincipal> <securityCredential>secret</securityCredential> <baseUserNamespace>ou=Users,DC=example,DC=com</baseUserNamespace> <userSearchFilter>(objectClass=person)</userSearchFilter> <usernameAttribute>mail</usernameAttribute>
Run
ldapsearch
command to check if all the users haveusernameAttribute
, for example:1
ldapsearch -h localhost -p 389 -b "ou=Users,dc=example,dc=com" -D "uid=admin,ou=system" -w "secret" \(\&\(objectClass=person\)\(\!\(mail=*\)\)\)
This command will return user entries that does not have
mail
attribute.
Cause
The username attribute configured in Bamboo does not exist in all the LDAP users.
Solution
Resolution
Make sure that all the LDAP user have the attribute that is configured to be used as username in Bamboo.
OR
Include the
usernameAttribute
into the user search filter in the fileatlassian-user.xml
and restart Bamboo, for example:1 2
<userSearchFilter>(&(objectClass=person)(mail=*))</userSearchFilter> <usernameAttribute>mail</usernameAttribute>
Was this helpful?