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

Duplicate entry initializing the company after upgrading to Liferay 7

    Details

    • Flagged:
      Impediment
    • Fix Priority:
      5

      Description

      Steps to reproduce it:

      1. Startup a 6.2 portal
      2. Shutdown it.
      3. Upgrade to Liferay 7.

      You will get the following exception:

      15:42:07,888 INFO  [localhost-startStop-1][AutoDeployDir:138] Auto deploy scanner started for /home/achaparro/servers/master/deploy
      15:52:01,097 ERROR [localhost-startStop-1][PortalInstances:374] com.liferay.portal.kernel.exception.SystemException: org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INSERT INTO Users_Roles (companyId, roleId, userId) VALUES (?, ?, ?)]; Duplicate entry '10165-10161' for key 'PRIMARY'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '10165-10161' for key 'PRIMARY'
      com.liferay.portal.kernel.exception.SystemException: org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INSERT INTO Users_Roles (companyId, roleId, userId) VALUES (?, ?, ?)]; Duplicate entry '10165-10161' for key 'PRIMARY'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '10165-10161' for key 'PRIMARY'
      	at com.liferay.portal.service.persistence.impl.TableMapperImpl.addTableMapping(TableMapperImpl.java:149)
      	at com.liferay.portal.service.persistence.impl.ReverseTableMapper.addTableMapping(ReverseTableMapper.java:36)
      	at com.liferay.portal.service.persistence.impl.UserPersistenceImpl.setRoles(UserPersistenceImpl.java:9005)
      	at com.liferay.portal.service.impl.RoleLocalServiceImpl.setUserRoles(RoleLocalServiceImpl.java:1280)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:153)
      	at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:93)
      	at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:55)
      	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:38)
      	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.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:173)
      	at com.sun.proxy.$Proxy70.setUserRoles(Unknown Source)
      	at com.liferay.portal.service.impl.CompanyLocalServiceImpl.checkCompany(CompanyLocalServiceImpl.java:377)
      

      Technical notes
      We are using 0 as companyId in com.liferay.portal.service.impl.UserLocalServiceImpl and that is wrong.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              cristina.gonzalez Cristina Gonzalez
              Reporter:
              alberto.chaparro Alberto Chaparro
              Participants of an Issue:
              Recent user:
              Esther Sanz
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                4 years, 49 weeks, 6 days ago

                  Packages

                  Version Package
                  7.0.0 Beta 2