i have a cascading dropdown which works fine on one system but fails to work on another system. pls refer to the code below: xhtml:
<p:selectOneMenu style="width: 150px" value="#{reportBean.exchange}">
<f:selectItem itemLabel="NSE" itemValue="nse"/>
<f:selectItem itemLabel="BSE" itemValue="bse"/>
<p:ajax update="sym" listener="#{reportBean.wow()}"/>
</p:selectOneMenu>
<h:outputText value="Scrip Symbol :"/>
<p:selectOneMenu value="#{reportBean.scripID}" id="sym" style="width: 100px">
<f:selectItem itemLabel="All" itemValue="0"/>
<f:selectItems var="scrip" value="#{reportBean.sl}" itemLabel="#{scrip.scripSymbol}" itemValue="#{scrip.scripID}"/>
</p:selectOneMenu>
the wow() method is not called, following is the bean code:
@javax.faces.bean.ManagedBean
@javax.faces.bean.ViewScoped
public class reportBean implements Serializable {
@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/localhost_8080/StatelessWebService/StatelessWebService.wsdl")
transient private StatelessWebService_Service service ;
private java.util.List<service.MasterScrip> getAllScripByExchange(java.lang.String exchange) {
service.StatelessWebService port = service.getStatelessWebServicePort();
return port.getAllScripByExchange(exchange);
}
public void wow()
{
sl=getAllScripByExchange(exchange);
}
i debugged and found that the debug point comes on the line
service.StatelessWebService port = service.getStatelessWebServicePort();
and goes into InvocationTargetException.java and goes tofollowing method:
public InvocationTargetException(Throwable target) {
super((Throwable)null); // Disallow initCause
this.target = target;
}
and finally in glassfish the error returned is:
WARNING: /ClientTemplate/tradeReport.xhtml @17,74 listener="#{reportBean.wow()}": java.lang.NullPointerException
javax.el.ELException: /ClientTemplate/tradeReport.xhtml @17,74 listener="#{reportBean.wow()}": java.lang.NullPointerException
in managd bean if i dont implement serializable or if i dont make the service as transient, then i get NotSerializable exception. what is the cause of this error? how do i solve it? edited:
serviceBean:
@ManagedBean
@javax.faces.bean.RequestScoped
public class serviceBean{
@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/localhost_8080/StatelessWebService/StatelessWebService.wsdl")
private StatelessWebService_Service service;
@ManagedProperty("#{reportBean}")
private reportBean reportBean;
public beans.reportBean getReportBean() {
return reportBean;
}
public void setReportBean(beans.reportBean reportBean) {
this.reportBean = reportBean;
} //other props
public String getExchange() {
return exchange;
}
public void setExchange(String exchange) {
this.exchange = exchange;
}
public void wow()
{
reportBean.setSl(getAllScripByExchange(reportBean.getExchange()));
}
reportBean:
@javax.faces.bean.ManagedBean
@javax.faces.bean.ViewScoped
public class reportBean implements Serializable {
private Integer scripID;
private String exchange;
private List<service.TradeStock> tradeList;
private List<MasterScrip> sl; //get set
now i get the following error:
SEVERE: Error Rendering View[/ClientTemplate/tradeReport.xhtml]
javax.faces.FacesException: java.io.NotSerializableException: service.MasterScrip