0 Replies Latest reply on May 17, 2011 8:23 AM by Karsten Wutzke

    Using EnumConverter in pages.xml: "FacesException: Expression Error: Named Object: javax.faces.Enum not found."

    Karsten Wutzke Expert

      Hello,


      I'm trying to use an enum converter in pages.xml to convert a URL param to a (JPA-mapped) enum but I get a stack trace at runtime.


      My pages.xml is:


       <page view-id="/group-list.xhtml">
        <param converterId="javax.faces.Integer" name="season"  value="#{seasonHome.id}"/>
        <param converterId="javax.faces.Integer" name="context" value="#{competitionHome.geoAreaId}"/>
        <param converterId="javax.faces.Enum"    name="type"    value="#{competitionHome.type}"/>
       </page>
      



      Examplary URL is:


      http://www.domain.com/mywebapp/group-list.seam?season=2002&context=268&type=LEAGUE


      That type there is an ENUM in the DB, too. I mapped it as enum in JPA correctly, I assure that.


      Now the following exception gets thrown when loading the page:


      17.05.2011 13:57:17 com.sun.faces.application.ApplicationImpl createConverter
      SCHWERWIEGEND: JSF1006: Cannot instantiate converter of type javax.faces.Enum
      17.05.2011 13:57:17 org.jboss.seam.navigation.Param convertValueFromString
      WARNUNG: could not create converter for: type
      javax.faces.FacesException: Expression Error: Named Object: javax.faces.Enum not found.
              at com.sun.faces.application.ApplicationImpl.createConverter(ApplicationImpl.java:750)
              at org.jboss.seam.jsf.SeamApplication.createConverter(SeamApplication.java:113)
              at org.jboss.seam.navigation.Param.getConverter(Param.java:62)
              at org.jboss.seam.navigation.Param.convertValueFromString(Param.java:226)
              at org.jboss.seam.navigation.Pages.convertAndValidateStringValuesInPageContext(Pages.java:815)
              at org.jboss.seam.navigation.Pages.postRestore(Pages.java:435)
              at org.jboss.seam.jsf.SeamPhaseListener.postRestorePage(SeamPhaseListener.java:544)
              at org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener.java:393)
              at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:229)
              at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:195)
              at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
              at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:103)
              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
              at java.lang.Thread.run(Unknown Source)
      



      I have no clue why this happens. Seems pretty basic to me. The javax.faces.Integer converters get instantiated without problem. This is a JSF 1.2 app and the EnumConverter class should be present.


      Does anyone know what's going on and more importantly how to fix this?


      Thanks


      Karsten


      PS: I'm using Seam 2.2.1 Final