Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
devaraj s
Error[PortletBeanLocatorUtil:38] BeanLocator is null for servlet context
9. August 2012 21:13
Antwort

devaraj s

Rang: Regular Member

Nachrichten: 216

Eintrittsdatum: 21. Mai 2012

Neue Beiträge

Hi,
I am creating Registaration portlet, by following liferay documentation i build service using service.xml file classes are generated in mysql database also..
By using those i written a java code to import data from registaration form to database.

but when control goes to this line of code(companyUserLocalServiceUtil.addcompanyUser(user)) its throwing exception like BeanLocator has not been set for servlet context .

I am going to produce my code here plz if anyone identifies error plz suggest me to resolve that exception.



Register.java

package com.test;

import java.io.IOException;
import java.util.Date;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;

import com.liferay.counter.service.CounterLocalServiceUtil;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
import com.test.model.companyUser;
import com.test.model.impl.companyUserImpl;
import com.test.service.companyUserLocalServiceUtil;

/**
* Portlet implementation class Register
*/
public class Register extends MVCPortlet
{

public void updateUser(ActionRequest actionRequest,
ActionResponse actionResponse)
throws IOException, PortletException {
cpmpanyUser user = new companyUserImpl();
// set primary key
long uid = 0L;
try {
uid =
CounterLocalServiceUtil.increment(
this.getClass().getName());
} catch (Exception e) {
e.printStackTrace();
}
user.setUid(uid);

// set UI fields
String FirstName="" +actionRequest.getParameter("fname");
user.setFname(FirstName);

String LastName="" +actionRequest.getParameter("lname");
user.setLname(LastName);

String EmployeeId = "" +actionRequest.getParameter("eid");
user.setEid(EmployeeId);
// set audit field(s)
user.setDateAdded(new Date());

// insert the book using persistence api
try {
companyUserLocalServiceUtil.addcompanyUser(user); <== in this line i m getting error
} catch (Exception e) {
e.printStackTrace();
}
String redirectURL = ParamUtil.getString(actionRequest, "redirectURL");
actionResponse.sendRedirect(redirectURL);
}



}
David H Nebinger
RE: Error[PortletBeanLocatorUtil:38] BeanLocator is null for servlet contex
10. August 2012 09:25
Antwort

David H Nebinger

Community Moderator

Rang: Liferay Legend

Nachrichten: 11787

Eintrittsdatum: 1. September 2006

Neue Beiträge

Search the forums, this issue has come up many times before and has been fixed many times before.
devaraj s
RE: Error[PortletBeanLocatorUtil:38] BeanLocator is null for servlet contex
11. August 2012 04:14
Antwort

devaraj s

Rang: Regular Member

Nachrichten: 216

Eintrittsdatum: 21. Mai 2012

Neue Beiträge

David H Nebinger:
Search the forums, this issue has come up many times before and has been fixed many times before.



I got the solutionemoticon.. thanks for reply
Kanakaraj Cheram
RE: Error[PortletBeanLocatorUtil:38] BeanLocator is null for servlet contex
27. Oktober 2012 09:59
Antwort

Kanakaraj Cheram

Rang: New Member

Nachrichten: 20

Eintrittsdatum: 8. April 2008

Neue Beiträge

devaraj s:
I got the solutionemoticon.. thanks for reply

Can you share the solution. Thanks.
David H Nebinger
RE: Error[PortletBeanLocatorUtil:38] BeanLocator is null for servlet contex
27. Oktober 2012 13:20
Antwort

David H Nebinger

Community Moderator

Rang: Liferay Legend

Nachrichten: 11787

Eintrittsdatum: 1. September 2006

Neue Beiträge

search the forums and you'll find the same info he did.
Harsha Mhaske
RE: Error[PortletBeanLocatorUtil:38] BeanLocator is null for servlet contex
6. April 2013 21:52
Antwort

Harsha Mhaske

Rang: New Member

Nachrichten: 15

Eintrittsdatum: 26. September 2008

Neue Beiträge

Kanakaraj Cheram:

Can you share the solution. Thanks.



Here it is: http://www.liferay.com/community/forums/-/message_boards/message/13630885