Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-70024

LDAP Import Users on Startup Causes Error

    Details

    • Fix Priority:
      2

      Description

      Description
      If a Liferay Portal instance is configured with LDAP and the Import Users on Startup option is checked, then an error will be generated during import on startup. This is due to the normal Scheduler for LDAP import firing at the same time as the import set by the Import on Startup option.

      Steps to Reproduce
      1. Add an LDAP server to a clean Portal instance.
      2. Enable LDAP and check the Enable Import and Enable Import on Startup options.
      3. Shut down the Portal and restart it.

      Expected Result
      The Portal should start without errors and users should import from LDAP during the startup process.

      Actual Result
      An error occurs during the startup process, as seen below:

      18:06:50,538 ERROR [liferay/scheduled_user_ldap_import-1][JDBCExceptionReporter:234] integrity constraint violation: unique constraint or index violation: IX_228562AD\
      18:06:50,545 ERROR [liferay/scheduled_user_ldap_import-1][SerialDestination:61] Unable to process message \{destinationName=liferay/scheduled_user_ldap_import, response=null, responseDestinationName=null, responseId=null, payload=null, values=\{GROUP_NAME=com.liferay.portal.security.ldap.internal.messaging.UserImportMessageListener, companyId=0, groupId=0, DESTINATION_NAME=liferay/scheduled_user_ldap_import, EXCEPTIONS_MAX_SIZE=0, JOB_STATE=com.liferay.portal.kernel.scheduler.JobState@4a84561d, STORAGE_TYPE=MEMORY_CLUSTERED, JOB_NAME=com.liferay.portal.security.ldap.internal.messaging.UserImportMessageListener\}\}\
      com.liferay.portal.kernel.messaging.MessageListenerException: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update\
      	at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:32)\
      	at com.liferay.portal.kernel.scheduler.messaging.SchedulerEventMessageListenerWrapper.receive(SchedulerEventMessageListenerWrapper.java:65)\
      	at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74)\
      	at com.liferay.portal.kernel.messaging.SerialDestination$1.run(SerialDestination.java:58)\
      	at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:756)\
      	at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:667)\
      	at java.lang.Thread.run(Thread.java:745)\
      Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update\
      	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)\
      	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)\
      	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)\
      	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268)\
      	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)\
      	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)\
      	at com.liferay.portal.dao.orm.hibernate.event.NestableFlushEventListener.onFlush(NestableFlushEventListener.java:61)\
      	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)\
      	at com.liferay.portal.spring.hibernate.PortletTransactionManager$TransactionStatusWrapper.reset(PortletTransactionManager.java:259)\
      	at com.liferay.portal.spring.hibernate.PortletTransactionManager.commit(PortletTransactionManager.java:63)\
      	at com.liferay.portal.spring.transaction.DefaultTransactionExecutor._commit(DefaultTransactionExecutor.java:128)\
      	at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.commit(DefaultTransactionExecutor.java:36)\
      	at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)\
      	at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:58)\
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)\
      	at com.liferay.portal.spring.aop.RetryAdvice.invoke(RetryAdvice.java:46)\
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)\
      	at com.liferay.portal.service.ServiceContextAdvice.invoke(ServiceContextAdvice.java:39)\
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)\
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)\
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)\
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)\
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)\
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)\
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)\
      	at com.liferay.portal.cache.thread.local.ThreadLocalCacheAdvice.invoke(ThreadLocalCacheAdvice.java:51)\
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)\
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)\
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)\
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)\
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)\
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)\
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)\
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)\
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)\
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)\
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)\
      	at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:174)\
      	at com.sun.proxy.$Proxy436.lock(Unknown Source)\
      	at com.liferay.portal.lock.internal.LockManagerImpl.lock(LockManagerImpl.java:121)\
      	at com.liferay.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl.importUsers(LDAPUserImporterImpl.java:383)\
      	at com.liferay.portal.security.ldap.internal.messaging.UserImportMessageListener.doReceive(UserImportMessageListener.java:105)\
      	at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:26)\
      	... 6 more\
      Caused by: java.sql.BatchUpdateException: integrity constraint violation: unique constraint or index violation: IX_228562AD\
      	at org.hsqldb.jdbc.JDBCPreparedStatement.executeBatch(JDBCPreparedStatement.java:1937)\
      	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)\
      	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)\
      	... 46 more\
      

      It is important to note here that, while this error occurs, it appears that because the standard import and import on startup are both trying to import the same set of users and one of them wins the race condition that causes this error, the users still import correctly from LDAP.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  2 years, 38 weeks, 5 days ago

                  Packages

                  Version Package
                  7.0.X EE