Foren

No Role exists with the key {companyId=0, name=Administrator}

thumbnail
Ram Dev, geändert vor 11 Jahren.

No Role exists with the key {companyId=0, name=Administrator}

Junior Member Beiträge: 46 Beitrittsdatum: 29.06.11 Neueste Beiträge
Hi ,

I am using Liferay 6.1 with MySQL 5.5 version on Ubuntu 12.0 as OS .

I have implmented a small task using finder Option with Service Builder , which resulted in below Error .

I am not sure of what can be done on this to resolve this .emoticon

Loading file:/usr/Liferay/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/temp/4-Test-portlet/WEB-INF/classes/portlet.properties
04:44:37,080 ERROR [pool-2-thread-3][HotDeployImpl:191] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for Test-portlet
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for Test-portlet
at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:46)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:123)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:188)
at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:27)
at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:151)
at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:141)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:64)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:56)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:52)
at com.liferay.portal.kernel.servlet.PluginContextListener.contextInitialized(PluginContextListener.java:103)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1099)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1621)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(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)
Caused by: com.liferay.portal.NoSuchRoleException: No Role exists with the key {companyId=0, name=Administrator}
at com.liferay.portal.service.persistence.RolePersistenceImpl.findByC_N(RolePersistenceImpl.java:2879)
at com.liferay.portal.service.impl.RoleLocalServiceImpl.loadGetRole(RoleLocalServiceImpl.java:865)
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:122)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:71)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:211)
at $Proxy88.loadGetRole(Unknown Source)
at com.liferay.portal.service.impl.RoleLocalServiceImpl.getRole(RoleLocalServiceImpl.java:538)
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:122)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:211)
at $Proxy88.getRole(Unknown Source)
at com.liferay.portal.service.impl.PortletLocalServiceImpl.checkPortlet(PortletLocalServiceImpl.java:157)
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:122)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:71)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:57)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:118)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:211)
at $Proxy66.checkPortlet(Unknown Source)
at com.liferay.portal.service.PortletLocalServiceUtil.checkPortlet(PortletLocalServiceUtil.java:273)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:429)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:120)
... 24 more




Hi ,

I have build a service.xml file as shown



<!--?xml version="1.0" encoding="UTF-8"?-->


<service-builder package-path="com.test">
   <author>sai</author>
   <namespace>Player</namespace>
   <entity name="Player" local-service="true" remote-service="false">
      <!-- PK fields -->
      <column name="PlayerId" type="long" primary="true" />
      <!-- Audit fields -->
      <column name="playerName" type="String" />
      <column name="category" type="String" />
      <finder name="Category" return-type="Collection">
         <finder-column name="category" />
      </finder>
   </entity>
</service-builder>



Ran the ant target “ant build-service

From the PlayerUtil.java copied the below Method to PlayerLocalServiceImpl.java with necessary modifications to it .


public static java.util.List<com.test.model.player> findByCategory(
		java.lang.String category)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getPersistence().findByCategory(category);
	}</com.test.model.player>



PlayerLocalServiceImpl.java

public class PlayerLocalServiceImpl extends PlayerLocalServiceBaseImpl 
{
public java.util.List<com.test.model.player> findByCategory(
			java.lang.String category)
			throws com.liferay.portal.kernel.exception.SystemException {
		return PlayerUtil.findByCategory(category);
	}
}</com.test.model.player>



Re Ran the ant target “ant build-service again .

Inserted Data to DataBase mysql as shown

SHOW TABLES FROM lportal LIKE 'Player'

INSERT INTO Player_Player (PlayerId, playerName , category) VALUES(123, 'Sai' ,'AllRounder' )


Tried to test this as shown


public class TestPortlet extends MVCPortlet {
	public void doView(RenderRequest renderRequest,
			RenderResponse renderResponse) throws IOException, PortletException {
		renderResponse.setContentType("text/html");
		List<player> customerList;
		try {
			customerList = PlayerLocalServiceUtil.findByCategory("AllRounder");
		System.out.println(customerList.size());
		} catch (SystemException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		PortletRequestDispatcher rd = getPortletConfig().getPortletContext()
				.getRequestDispatcher("/html/test/view.jsp");
		if (rd != null) {
			rd.include(renderRequest, renderResponse);
		}

	}
}

</player>
The below is my portlet.xml file


<!--?xml version="1.0"?-->

<portlet-app version="2.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
	
	<portlet>
		<portlet-name>test</portlet-name>
		<display-name>Test Portlet</display-name>
		<portlet-class>com.test.TestPortlet</portlet-class>
		<init-param>
			<name>view-template</name>
			<value>/html/test/view.jsp</value>
		</init-param>
		<expiration-cache>0</expiration-cache>
		<supports>
			<mime-type>text/html</mime-type>
			<portlet-mode>view</portlet-mode>
		</supports>
		<portlet-info>
			<title>Test Portlet</title>
			<short-title>Test Portlet</short-title>
			<keywords></keywords>
		</portlet-info>
		<security-role-ref>
			<role-name>administrator</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>guest</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>power-user</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>user</role-name>
		</security-role-ref>
	</portlet>
</portlet-app>

Please let me know how to resolve this Error

Caused by: com.liferay.portal.NoSuchRoleException: No Role exists with the key {companyId=0, name=Administrator}
thumbnail
Filip Rak, geändert vor 10 Jahren.

RE: No Role exists with the key {companyId=0, name=Administrator}

New Member Beiträge: 15 Beitrittsdatum: 10.02.10 Neueste Beiträge
Hi
had similar problem - lead me to this post, I tracked it down to multiply instances of Liferay. In my case extra instance was added just in order to test the feature, and was no longer needed. Removing additional instance via SQL fixed my problem, maybe my experience will help you.

Filip
Ajay Kajla, geändert vor 9 Jahren.

RE: No Role exists with the key {companyId=0, name=Administrator}

New Member Beiträge: 4 Beitrittsdatum: 03.07.14 Neueste Beiträge
Hello,

>>Please let me know how to resolve this Error
>>Caused by: com.liferay.portal.NoSuchRoleException: No Role exists with the key {companyId=0, name=Administrator}

We got the similar error. Our primary Liferay portal was not opening. At that time mysql was not answering queries properly because the disk space was 100% full. As soon as I deleted some old backups and created some free space. I restarted mysql and tomcat, then the primary LifeRay portal came back online.

My question is that is it really because of disk full issue on the server that created this (NoSuchRoleException) error?

Regards,
Ajay
Ajay Kajla, geändert vor 9 Jahren.

RE: No Role exists with the key {companyId=0, name=Administrator}

New Member Beiträge: 4 Beitrittsdatum: 03.07.14 Neueste Beiträge
Answering my own query.

The issue has been completely replicated on staging machine and got the same results.

1. Created same application environment with Tomcat/LifeRay/MySQL and same application
2. Filled the disk space 100%.
3. Restarted Tomacat (Until Tomcat restart, the main portal application was opening fine)
4. Got following errors in LifeRay Logs.

root@s_emoticon_-:/usr/liferay-portal-6.1.20-ee-ga2/logs# cat liferay.2014-11-08.log | grep Administrator
Caused by: com.liferay.portal.NoSuchRoleException: No Role exists with the key {companyId=0, name=Administrator}
Caused by: com.liferay.portal.NoSuchRoleException: No Role exists with the key {companyId=0, name=Administrator}

Case Closed.
-Ajay
thumbnail
Andew Jardine, geändert vor 9 Jahren.

RE: No Role exists with the key {companyId=0, name=Administrator}

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
I have the error, but have more than 38% free disk so this is not the root cause for me. I am working in a multi-instance configuration though so I suspect my problem has something to do with one or more instances not being setup correctly when they were added.
Sameer Naik, geändert vor 6 Jahren.

RE: No Role exists with the key {companyId=0, name=Administrator}

Junior Member Beiträge: 25 Beitrittsdatum: 09.03.10 Neueste Beiträge
Andrew Jardine:
I have the error, but have more than 38% free disk so this is not the root cause for me. I am working in a multi-instance configuration though so I suspect my problem has something to do with one or more instances not being setup correctly when they were added.


In our case this error was seen when all users of a virtual instance were deleted, leaving only default user in there.
Setting virtual instance inactive also did not help.
We ended up deleting all data of the virtual instance from database.
Other workaround is to add one user to the instance.

-- Sameer