Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: 6.2 GA6 - DuplicateRoleException: {roleId=0}
Hi
We are using 6.2 GA6 bundle on Linux (CentOS 7) environment with Mariadb 5.5.56 and we are getting an exception during startup:
Could anyone shed some light on this, please?
Thanks.
We are using 6.2 GA6 bundle on Linux (CentOS 7) environment with Mariadb 5.5.56 and we are getting an exception during startup:
13:01:59,385 ERROR [localhost-startStop-1][InstanceUtil:75] com.liferay.portal.DuplicateRoleException: {roleId=0}
com.liferay.portal.DuplicateRoleException: {roleId=0}
at com.liferay.portal.service.impl.RoleLocalServiceImpl.validate(RoleLocalServiceImpl.java:1676)
at com.liferay.portal.service.impl.RoleLocalServiceImpl.addRole(RoleLocalServiceImpl.java:208)
at com.liferay.portal.service.impl.RoleLocalServiceImpl.addRole(RoleLocalServiceImpl.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
at com.sun.proxy.$Proxy95.addRole(Unknown Source)
at com.liferay.portal.service.RoleLocalServiceUtil.addRole(RoleLocalServiceUtil.java:606)
at com.liferay.so.util.InstanceUtil.setupRole(InstanceUtil.java:538)
at com.liferay.so.util.InstanceUtil.initInstance(InstanceUtil.java:66)
at com.liferay.so.hook.events.StartupAction.doRun(StartupAction.java:50)
at com.liferay.so.hook.events.StartupAction.run(StartupAction.java:35)
at com.liferay.portal.kernel.events.InvokerSimpleAction.run(InvokerSimpleAction.java:42)
at com.liferay.portal.deploy.hot.HookHotDeployListener.initEvent(HookHotDeployListener.java:1390)
at com.liferay.portal.deploy.hot.HookHotDeployListener.initEvents(HookHotDeployListener.java:1453)
at com.liferay.portal.deploy.hot.HookHotDeployListener.initPortalProperties(HookHotDeployListener.java:1775)
at com.liferay.portal.deploy.hot.HookHotDeployListener.doInvokeDeploy(HookHotDeployListener.java:720)
at com.liferay.portal.deploy.hot.HookHotDeployListener.invokeDeploy(HookHotDeployListener.java:314)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:230)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:257)
at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:28)
at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:164)
at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:154)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:44)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:74)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:58)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:54)
at com.liferay.portal.kernel.servlet.PluginContextListener.contextInitialized(PluginContextListener.java:116)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Could anyone shed some light on this, please?
Thanks.
Hi Tom,
Just gonna ask this straight up -- if you run a query on the Role table, do you get more than one record with a 0 value?
.. I mean you shouldn't have been able to add it in the first place since the value is required as unique, but if someone was mucking around with SQL queries directly on the tables (and not using the API) then it is possible that someone messed it up.
Also, do you have any startup hooks? perhaps something that is used to auto-populate roles? or perhaps some code that does something similar in an init() method for a portlet? I ask because it is strange to see a stack trace like this in the startup process.
Just gonna ask this straight up -- if you run a query on the Role table, do you get more than one record with a 0 value?

Also, do you have any startup hooks? perhaps something that is used to auto-populate roles? or perhaps some code that does something similar in an init() method for a portlet? I ask because it is strange to see a stack trace like this in the startup process.
Hi there,
Thanks. Are we talking about duplicate values in "RoleID" column? If so the values are 10161 - 10171, 10487, 10489, 10491, 20258 and 40437 - no duplicates here. All values in "uuid_" are unique. I can see duplicates in "userId" column though (all entries apart of one are the same), but this is how it should be I think. "Type" column has some duplicates too. The only extension we know of that could affect that table is Social Office.
Hey Tom,
Yep, all of that sounds right. You mentioned though that you are getting this error on startup? Can you tell me if you have any plugins that try to manage roles dynamically?
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™