Forums de discussion

Issue with BeanLocator in JSF portlets

thumbnail
Fahad v, modifié il y a 9 années.

Issue with BeanLocator in JSF portlets

Junior Member Publications: 35 Date d'inscription: 14/07/14 Publications récentes
Hi all,

I have created a JSF portlet to display the PIE Graph.
When i used static data the graph worked correctly, then i tried the same graph with adding data from service layer.
Then it shown BeanLocator not found.
package com.test;


import com.eteam.service.StudentLocalServiceUtil;
import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import org.primefaces.model.chart.PieChartModel;

@ManagedBean
@RequestScoped
public class Bean {
	
	private PieChartModel model;

	public Bean() {
		
	}

	public PieChartModel getModel() {
		
		model.set("Passed", StudentLocalServiceUtil.getPassedList());
		model.set("Failed", StudentLocalServiceUtil.getFailedList());
		model.set("Brand 1", 540);
		model.set("Brand 2", 325);
		//model.set("Brand 3", 702);
		//model.set("Brand 4", 421);
		return model;
	}
}


My view part is
<!--?xml version="1.0"?-->

<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head />
    <h:body>
    	<p:calendar></p:calendar>
        <h:form>
           <p:piechart value="#{bean.model}" legendPosition="e" sliceMargin="7" />
        </h:form>
    </h:body>
</f:view>


Why the error " BeanLocator is null for servlet context" and " BeanLocator not found for servlet context" error is coming ?
Why *LocalServiceUtil cannot be called in a managed bean in JSF ?
Can anyone help emoticon
emoticonemoticon
thumbnail
Neil Griffin, modifié il y a 9 années.

RE: Issue with BeanLocator in JSF portlets

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Hi Fahad,

Fahad v:

Why *LocalServiceUtil cannot be called in a managed bean in JSF ?
Can anyone help emoticon
emoticonemoticon


The good news is that ServiceBuilder generated services are fully compatible with JSF portlets. The "BeanLocator is null for servlet context" that you are seeing is unrelated to JSF. It is probably caused by a configuration error. Starting from a new/clean project normally fixes these types of problems. For example, this other thread offers some suggestions for correcting the problem.

Kind Regards,

Neil
thumbnail
Fahad v, modifié il y a 9 années.

RE: Issue with BeanLocator in JSF portlets

Junior Member Publications: 35 Date d'inscription: 14/07/14 Publications récentes
Hi Griffin,

i found the real issue.
This happens if the service is not deployed correctly.
i made changes in service and deployed it again, it worked.

emoticon