Hello every one.
I have a problem with my <rich:picklist> and I wonder If somebody could help.
when executing the application I got the following error:
javax.ejb.EJBException at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3869) at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3769) ... at org.richfaces.renderkit.html.PickListRendererGen.doEncodeChildren(PickListRendererGen.java:344) at org.richfaces.renderkit.html.PickListRendererGen.doEncodeChildren(PickListRendererGen.java:258) .... Caused by: java.lang.NullPointerException at com.pingwy.daiki.management.action.AdminActionBean.selectCompanyNamesOption(AdminActionBean.java:149) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ....
@Stateful
@Name("adminAction")
@Scope(ScopeType.SESSION)
public class AdminActionBean implements AdminActionLocal {
@Out(required=false)
private List<Customer> companyNames;
@In(required=false)
private List<Customer> customersChoice;
@Out(required=false)
private ArrayList<SelectItem> companyNamesOption;
@Factory("companyNames")
public void selectCompanyNames(){
setCompanyNames((List<Customer>) getEm().createQuery("select c from Customer c")
.getResultList());
}
@Factory("companyNamesOption")
public void selectCompanyNamesOption(){
for (int i=0;i <companyNames.size();i++){
companyNamesOption.add(new SelectItem(companyNames.get(i), companyNames.get(i).getCompanyName(), companyNames.get(i).getCompanyName() ) );
}
}
// getter and setter
<rich:pickList id="customersChoice" value="#{adminAction.customersChoice}">
<f:selectItems value="#{companyNamesOption}" />
</rich:pickList>