Legacy Knowledge Base
Published Jun. 30, 2025

"Unable to import user" messages when performing concurrent authenticated JSONWS calls against an LDAP cluster

Written By

Daniel Couso

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

  • Given an environment with the following components configured:
    • LDAP cluster with more than one node.
    • JSONWS calls through basic authentication.
    • LDAP Import enabled.
    • Login against LDAP.
  • Several concurrent authenticated JSONWS calls are executed from the same user with basic authentication against the LDAP cluster.
  • Several messages like the following are displayed in server logs:
[LDAPUserImporterImpl:1191] Unable to import user 123456
com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: {"agreedToTermsOfUse":false,"comments":"","companyId":"10743","contactId":"101338","createDate":1441663510732,"ctCollectionId":"0","defaultUser":false,"emailAddress":"","emailAddressVerified":true,"externalReferenceCode":"","facebookId":"0","failedLoginAttempts":0,"firstName":"firstName","googleUserId":"","graceLoginCount":0,"greeting":"Welcome firstName lastName!","jobTitle":"","languageId":"en_US","lastFailedLoginDate":1657878886290,"lastLoginDate":1679988956482,"lastLoginIP":"1.2.3.4","lastName":"lastName","ldapServerId":"12536","lockout":false,"lockoutDate":null,"loginDate":1683528127592,"loginIP":"1.2.3.4","middleName":"","modifiedDate":1698932521000,"mvccVersion":"332381","openId":"","portraitId":"0","reminderQueryAnswer":"","reminderQueryQuestion":"","screenName":"screenName","status":0,"timeZoneId":"UTC","userId":"101337","uuid":"96e52ac8-4382-4daa-984d-25b3bb1b111e"} is stale in comparison to {"agreedToTermsOfUse":false,"comments":"","companyId":"10743","contactId":"101338","createDate":1441663510732,"ctCollectionId":"0","defaultUser":false,"emailAddress":"","emailAddressVerified":true,"externalReferenceCode":"","facebookId":"0","failedLoginAttempts":0,"firstName":"firstName","googleUserId":"","graceLoginCount":0,"greeting":"Welcome fistName lastName!","jobTitle":"","languageId":"en_US","lastFailedLoginDate":1657878886290,"lastLoginDate":1679988956482,"lastLoginIP":"1.2.3.4","lastName":"lastName","ldapServerId":"12536","lockout":false,"lockoutDate":null,"loginDate":1683528127592,"loginIP":"1.2.3.4","middleName":"","modifiedDate":1698932341000,"mvccVersion":"332382","openId":"","portraitId":"0","reminderQueryAnswer":"","reminderQueryQuestion":"","screenName":"screenName","status":0,"timeZoneId":"UTC","userId":"101337","uuid":"96e52ac8-4382-4daa-984d-25b3bb1b111e"}
at com.liferay.portal.kernel.service.persistence.impl.BasePersistenceImpl.processException(BasePersistenceImpl.java:573)
at com.liferay.portal.service.persistence.impl.UserPersistenceImpl.updateImpl(UserPersistenceImpl.java:8624)
at com.liferay.portal.service.persistence.impl.UserPersistenceImpl.updateImpl(UserPersistenceImpl.java:92)
at com.liferay.portal.kernel.service.persistence.impl.BasePersistenceImpl.update(BasePersistenceImpl.java:710)
at com.liferay.portal.service.impl.UserLocalServiceImpl.updatePassword(UserLocalServiceImpl.java:5066)
at sun.reflect.GeneratedMethodAccessor903.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:66)
at com.sun.proxy.$Proxy644.updatePassword(Unknown Source)
at com.liferay.portal.kernel.service.UserLocalServiceWrapper.updatePassword(UserLocalServiceWrapper.java:3402)
at sun.reflect.GeneratedMethodAccessor903.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:66)
at com.sun.proxy.$Proxy645.updatePassword(Unknown Source)
at sun.reflect.GeneratedMethodAccessor903.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:50)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:69)
at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:57)
at com.liferay.portal.spring.aop.AopInvocationHandler.invoke(AopInvocationHandler.java:49)
at com.sun.proxy.$Proxy66.updatePassword(Unknown Source)
at com.liferay.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl.updateUserPassword(LDAPUserImporterImpl.java:1792)
at com.liferay.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl.updateUser(LDAPUserImporterImpl.java:1641)
at com.liferay.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl.importUser(LDAPUserImporterImpl.java:1166)
at com.liferay.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl.importUser(LDAPUserImporterImpl.java:186)
at com.liferay.portal.security.ldap.internal.authenticator.LDAPAuth.authenticate(LDAPAuth.java:384)
at com.liferay.portal.security.ldap.internal.authenticator.LDAPAuth.authenticateAgainstPreferredLDAPServer(LDAPAuth.java:590)
at com.liferay.portal.security.ldap.internal.authenticator.LDAPAuth.authenticate(LDAPAuth.java:493)
at com.liferay.portal.security.ldap.internal.authenticator.LDAPAuth.authenticateByEmailAddress(LDAPAuth.java:99)
at com.liferay.portal.security.auth.AuthPipeline._authenticate(AuthPipeline.java:146)
at com.liferay.portal.security.auth.AuthPipeline.authenticateByEmailAddress(AuthPipeline.java:39)
at com.liferay.portal.service.impl.UserLocalServiceImpl.authenticate(UserLocalServiceImpl.java:5886)
at com.liferay.portal.service.impl.UserLocalServiceImpl.authenticateByEmailAddress(UserLocalServiceImpl.java:1427)
at sun.reflect.GeneratedMethodAccessor713.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:66)
at com.sun.proxy.$Proxy644.authenticateByEmailAddress(Unknown Source)
at com.liferay.portal.kernel.service.UserLocalServiceWrapper.authenticateByEmailAddress(UserLocalServiceWrapper.java:583)
at sun.reflect.GeneratedMethodAccessor713.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:66)
at com.sun.proxy.$Proxy645.authenticateByEmailAddress(Unknown Source)
at sun.reflect.GeneratedMethodAccessor713.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:50)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:69)
at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:57)
at com.liferay.portal.spring.aop.AopInvocationHandler.invoke(AopInvocationHandler.java:49)
at com.sun.proxy.$Proxy66.authenticateByEmailAddress(Unknown Source)
at com.liferay.portal.kernel.service.UserLocalServiceUtil.authenticateByEmailAddress(UserLocalServiceUtil.java:579)
at com.liferay.portal.security.auth.session.AuthenticatedSessionManagerImpl._getAuthenticatedUser(AuthenticatedSessionManagerImpl.java:491)
at com.liferay.portal.security.auth.session.AuthenticatedSessionManagerImpl.getAuthenticatedUserId(AuthenticatedSessionManagerImpl.java:77)
at com.liferay.portal.kernel.security.auth.session.AuthenticatedSessionManagerUtil.getAuthenticatedUserId(AuthenticatedSessionManagerUtil.java:40)
at com.liferay.portal.security.auth.http.HttpAuthManagerImpl.getBasicUserId(HttpAuthManagerImpl.java:276)
at com.liferay.portal.security.auth.http.HttpAuthManagerImpl.getUserId(HttpAuthManagerImpl.java:164)
at com.liferay.portal.kernel.security.auth.http.HttpAuthManagerUtil.getUserId(HttpAuthManagerUtil.java:56)
at com.liferay.portal.security.auto.login.basic.auth.header.BasicAuthHeaderAutoLoginSupport.doLogin(BasicAuthHeaderAutoLoginSupport.java:73)
at com.liferay.portal.kernel.security.auto.login.BaseAutoLogin.login(BaseAutoLogin.java:38)
at com.liferay.portal.security.auth.verifier.internal.basic.auth.header.BasicAuthHeaderAuthVerifier.verify(BasicAuthHeaderAuthVerifier.java:56)
at com.liferay.portal.security.auth.AuthVerifierPipeline._verifyRequest(AuthVerifierPipeline.java:285)
at com.liferay.portal.security.auth.AuthVerifierPipeline.verifyRequest(AuthVerifierPipeline.java:71)
at com.liferay.portal.security.access.control.AccessControlImpl.verifyRequest(AccessControlImpl.java:93)
at com.liferay.portal.kernel.security.access.control.AccessControlUtil.verifyRequest(AccessControlUtil.java:100)
at com.liferay.portal.servlet.filters.authverifier.AuthVerifierFilter.processFilter(AuthVerifierFilter.java:147)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:215)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.servlet.filters.password.modified.PasswordModifiedFilter.processFilter(PasswordModifiedFilter.java:62)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:215)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.servlet.filters.lockout.LockoutFilter.processFilter(LockoutFilter.java:58)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:215)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:147)
at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:248)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:215)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:196)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:99)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:196)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:99)
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389)
at com.liferay.portal.servlet.filters.urlrewrite.UrlRewriteFilter.processFilter(UrlRewriteFilter.java:65)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:215)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:175)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:99)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:175)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:99)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:196)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:99)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:104)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:432)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:880)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1601)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.liferay.portal.kernel.dao.orm.ORMException: {"agreedToTermsOfUse":false,"comments":"","companyId":"10743","contactId":"101338","createDate":1441663510732,"ctCollectionId":"0","defaultUser":false,"emailAddress":"","emailAddressVerified":true,"externalReferenceCode":"","facebookId":"0","failedLoginAttempts":0,"firstName":"firstName","googleUserId":"","graceLoginCount":0,"greeting":"Welcome firstName lastName!","jobTitle":"","languageId":"en_US","lastFailedLoginDate":1657878886290,"lastLoginDate":1679988956482,"lastLoginIP":"1.2.3.4","lastName":"lastName","ldapServerId":"12536","lockout":false,"lockoutDate":null,"loginDate":1683528127592,"loginIP":"1.2.3.4","middleName":"","modifiedDate":1698932521000,"mvccVersion":"332381","openId":"","portraitId":"0","reminderQueryAnswer":"","reminderQueryQuestion":"","screenName":"screenName","status":0,"timeZoneId":"UTC","userId":"101337","uuid":"96e52ac8-4382-4daa-984d-25b3bb1b111e"} is stale in comparison to {"agreedToTermsOfUse":false,"comments":"","companyId":"10743","contactId":"101338","createDate":1441663510732,"ctCollectionId":"0","defaultUser":false,"emailAddress":"","emailAddressVerified":true,"externalReferenceCode":"","facebookId":"0","failedLoginAttempts":0,"firstName":"firstName","googleUserId":"","graceLoginCount":0,"greeting":"Welcome fistName lastName!","jobTitle":"","languageId":"en_US","lastFailedLoginDate":1657878886290,"lastLoginDate":1679988956482,"lastLoginIP":"1.2.3.4","lastName":"lastName","ldapServerId":"12536","lockout":false,"lockoutDate":null,"loginDate":1683528127592,"loginIP":"1.2.3.4","middleName":"","modifiedDate":1698932341000,"mvccVersion":"332382","openId":"","portraitId":"0","reminderQueryAnswer":"","reminderQueryQuestion":"","screenName":"screenName","status":0,"timeZoneId":"UTC","userId":"101337","uuid":"96e52ac8-4382-4daa-984d-25b3bb1b111e"}
at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(ExceptionTranslator.java:67)
at com.liferay.portal.dao.orm.hibernate.SessionImpl.merge(SessionImpl.java:329)
at com.liferay.portal.service.persistence.impl.UserPersistenceImpl.updateImpl(UserPersistenceImpl.java:8620)
... 122 more
Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.liferay.portal.model.impl.UserImpl#123456]
at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:485)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:255)
at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:84)
at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:867)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:851)
at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:855)
at com.liferay.portal.dao.orm.hibernate.SessionImpl.merge(SessionImpl.java:326)
... 123 more

Environment

  • Liferay DXP 7.0, 7.1, 7.2, 7.3, 7.4
  • Quaterly Releases, 2023.Q3, 2023.Q4

Resolution

  • The root cause is due to the following concurrent circumstances:
    • The system LDAP attribute modifyTimestamp is not replicable between LDAP nodes, so there may be a little variation of seconds between the nodes of the LDAP cluster for the user's record due to the data replications between these nodes.
    • The attribute modifyTimestamp is taken into account by Liferay DXP to perform or not updates over the user's record in the table User_ if this attribute has changed.
    • Since LDAP nodes can store different modifyTimestamp values and Liferay DXP can query both of them, it can obtained different modifyTimestamp values triggering updates from the user's LDAP record to the user's database record.
  • This scenario does not constitute a product bug.
  • This scenario cannot be reproduced in Liferay Portal 6.2 EE and lower versions due to the pessimistic locking strategy for transactions used in those versions, instead of the optimistic locking schema used in Liferay DXP 7.0 and higher.
  • The following points are alternatives to avoid this situation:
    • Use a different authentication/authorization schema like OAuth2 instead of Basic or Digest authentication, which does not involve logging in against LDAP.
    • Ensure that only one and always the same node of the LDAP nodes is queried at the time of authenticating this user.
    • Use different users to perform the JSONWS calls so that there is no concurrent calls executing at the same time by the same user.
Did this article resolve your issue ?

Legacy Knowledge Base