I recently migrated my JSF app(using primefaces) from glassfish 3.1 to tomcat7 server. Previously passing the enum value as string to managed bean methods through actionlistener
attribute worked(without the need for a converter to convert string to enum) but now it fails with javax.el.MethodNotFoundException
.
JSF page:
<h:form> <h:outputLabel value="Title"/><br/> <p:inputText value="#{lobController.current.title}"/> <p:commandButton action="#{lobController.create('CAR')}" value="Post"/> </h:form>
Mangaged bean method
public void create(Type type) { ... }
Log messages:
javax.el.MethodNotFoundException: /_newLOB.xhtml @85,111 action="#{lobController.create('CAR')}": Method not found: [email protected](java.lang.String) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:110) at javax.faces.component.UICommand.broadcast(UICommand.java:315) at javax.faces.component.UIData.broadcast(UIData.java:1093) at javax.faces.component.UIData.broadcast(UIData.java:1093) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
Edit
This starts working if I change the managed bean method as follow:
public void create(String type) { Type type = Type.valueOf(type); ... }
Using Primefaces 3.1 with JSF 2.1.6 on Tomcat 7.0.14