Legacy Knowledge Base
Published Jul. 2, 2025

Unable to import User Groups from LDAP containing a comma "," or an asterisk "*"

Written By

Dávid Hegedüs

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • Receiving the following error when trying to import User Groups from LDAP containing a comma "," or an asterisk "*":
2020-06-04 08:23:50.268 WARN [main][LDAPUserImporterImpl:1165] Unable to create user group test,users
2020-06-04 08:23:50.280 ERROR [main][LDAPUserImporterImpl:780] Unable to import group cn=test\,users,ou=groups: null:null:{cn=cn: test,users} java.lang.NullPointerException
 at com.liferay.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl.getUsers(LDAPUserImporterImpl.java:720)
 at com.liferay.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl.importFromLDAPByGroup(LDAPUserImporterImpl.java:763)
 at com.liferay.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl.importUsers(LDAPUserImporterImpl.java:474)
 at com.liferay.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl.importUsers(LDAPUserImporterImpl.java:415)
...

Environment

  • Liferay Portal 6.0+
  • Liferay DXP 7.0+
  • LDAP

Resolution

  • User Groups in Liferay can not contain "," and "*" in their names, therefore generates com.liferay.portal.kernel.exception.UserGroupNameException when trying to add the User Group based on the LDAP Group. The NullPointerException happens because later when #getUsers is invoked it receives "null" as User Group.
  • A possible workaround would be to:
    1. Create a custom @Component that implements com.liferay.portal.security.ldap.exportimport.LDAPToPortalConverter: in the importLDAPGroup method
    2. Implement a custom logic that accounts the special characters in a way that is suitable (for example remove the comma)
    3. So when ldapGroup.getGroupName() will be used later as the name for the User Group to be created in
      LDAPUserImporterImpl.importUserGroup(long, Attributes, Properties) it won't fail and the User Group will be created.

Additional Information

  • Please find the default implementation on this link

 

Did this article resolve your issue ?

Legacy Knowledge Base