Foren
Error[PortletBeanLocatorUtil:38] BeanLocator is null for servlet context
devaraj s, geändert vor 11 Jahren.
Error[PortletBeanLocatorUtil:38] BeanLocator is null for servlet context
Regular Member Beiträge: 228 Beitrittsdatum: 21.05.12 Neueste 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);
}
}
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, geändert vor 11 Jahren.
RE: Error[PortletBeanLocatorUtil:38] BeanLocator is null for servlet contex
Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
Search the forums, this issue has come up many times before and has been fixed many times before.
devaraj s, geändert vor 11 Jahren.
RE: Error[PortletBeanLocatorUtil:38] BeanLocator is null for servlet contex
Regular Member Beiträge: 228 Beitrittsdatum: 21.05.12 Neueste BeiträgeDavid H Nebinger:
Search the forums, this issue has come up many times before and has been fixed many times before.
I got the solution.. thanks for reply
Kanakaraj Cheram, geändert vor 11 Jahren.
RE: Error[PortletBeanLocatorUtil:38] BeanLocator is null for servlet contex
New Member Beiträge: 20 Beitrittsdatum: 08.04.08 Neueste Beiträgedevaraj s:
I got the solution.. thanks for reply
Can you share the solution. Thanks.
David H Nebinger, geändert vor 11 Jahren.
RE: Error[PortletBeanLocatorUtil:38] BeanLocator is null for servlet contex
Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
search the forums and you'll find the same info he did.
Harsha M, geändert vor 11 Jahren.
RE: Error[PortletBeanLocatorUtil:38] BeanLocator is null for servlet contex
New Member Beiträge: 15 Beitrittsdatum: 26.09.08 Neueste BeiträgeKanakaraj Cheram:
Can you share the solution. Thanks.
Here it is: http://www.liferay.com/community/forums/-/message_boards/message/13630885