Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8682405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:45:48+00:00 2026-06-12T21:45:48+00:00

In liferay, I am trying to access the role data available in the database

  • 0

In liferay, I am trying to access the role data available in the database using the API.

I am using the com.liferay.portal.service.RoleLocalServiceUtil class to access Role’s.
Below is my code:

Role role = RoleLocalServiceUtil.getRole(10138);
ans = ans+role.getName()+","+role.getRoleId();

Role by Id 10138 exists in the database.

But the above throws the below exception:
com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set
com.liferay.portal.kernel.bean.PortalBeanLocatorUtil.locate(PortalBeanLocatorUtil.java:33)
com.liferay.portal.service.RoleLocalServiceUtil.getService(RoleLocalServiceUtil.java:446)
com.liferay.portal.service.RoleLocalServiceUtil.getRole(RoleLocalServiceUtil.java:166)
com.bl.retail.controller.KPIController.changeAccess(KPIController.java:70)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
……….

How do I set the BeanLocator? I have spent so much stupid time on it, please help!

PS: The above code is from a seperate servlet running on the same liferay server.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T21:45:49+00:00Added an answer on June 12, 2026 at 9:45 pm

    Answering my own question:

    This was happening because the role data access was done from another Servlet.

    When I used the same code from within the portlet it worked all fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to override the getDescriptiveName() method in com.liferay.portal.model.Group I found a wrapper (com.liferay.portal.model.GroupWrapper),
I am using liferay technology and trying to retrieve data from xml file in
I'm trying to install liferay IDE (from tutorial: http://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/installation ) The problem appears after
I am using Liferay 6.1 CE for Portal Application development . I am trying
I am new to Liferay Portal and am using 6.1 CE. I am trying
I am trying to import wordpress content into liferay 6.1 using the wordpress importer
I am trying to write a portlet for Liferay (using Tomcat and Spring) and
Hi i'm trying to build Liferay from source, i've downloaded liferay-portal-src-5.2.3.zip but when i
I am trying to create a simple portlet for Liferay 5.2.2 using Grails 1.2.1
I am trying to get the HttpServletResponse from liferay portal. I am also working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.