1

I have an application using JSF 2.0.11 and RichFaces 4.3.4. I tried to upgrade to JSF 2.1.19 and started getting the following exception. It doesnt seem to make sense, as the app builds fine

java.lang.RuntimeException: javax.servlet.ServletException: java.lang.Error: Unresolved compilation problems: 
    The method getViewMap() is undefined for the type UIViewRoot
    The method getViewMap() is undefined for the type UIViewRoot
    The method getViewMap() is undefined for the type UIViewRoot
    The method getViewMap() is undefined for the type UIViewRoot

    gov.gsa.pbs.rexus.common.webtier.RexusSecFilter.doFilter(RexusSecFilter.java:218)
    org.omnifaces.filter.GzipResponseFilter.doFilter(GzipResponseFilter.java:149)
    org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:75)



root cause 
javax.servlet.ServletException: java.lang.Error: Unresolved compilation problems: 
    The method getViewMap() is undefined for the type UIViewRoot
    The method getViewMap() is undefined for the type UIViewRoot
    The method getViewMap() is undefined for the type UIViewRoot
    The method getViewMap() is undefined for the type UIViewRoot

    javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
    gov.gsa.pbs.rexus.common.webtier.RexusSecFilter.doFilter(RexusSecFilter.java:209)
    org.omnifaces.filter.GzipResponseFilter.doFilter(GzipResponseFilter.java:149)
    org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:75)



root cause 
javax.faces.el.EvaluationException: java.lang.Error: Unresolved compilation problems: 
    The method getViewMap() is undefined for the type UIViewRoot
    The method getViewMap() is undefined for the type UIViewRoot
    The method getViewMap() is undefined for the type UIViewRoot
    The method getViewMap() is undefined for the type UIViewRoot

    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:101)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:786)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1251)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    gov.gsa.pbs.rexus.common.webtier.RexusSecFilter.doFilter(RexusSecFilter.java:209)
    org.omnifaces.filter.GzipResponseFilter.doFilter(GzipResponseFilter.java:149)
    org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:75)
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Dan Hunt
  • 13
  • 2

1 Answers1

0

This exception suggests that the runtime classpath contains a JSF 1.x API along with JSF 2.x impl. That method was indeed introduced in JSF 2.0 API and is absent in any JSF 1.x API.

Cleanup your runtime classpath to get rid of those JSF 1.x API libraries. Typically, they have the filename jsf-api.jar. If necessary, put the JSF 2.1.19 compatible API in place. That should be unnecessary if you use the single javax.faces-2.1.19.jar file.

When in vain, tell in detail which servletcontainer impl/version you're using and which files are all present in the /WEB-INF/lib folder of the built WAR file.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Agreed on the diagnosis, but I cant find an offending reference to JSF 1.x in the source and there was only one jar file in the MyEclipse springrframework which I removed and restarted MyEclipse. The app will build and work using JSF 2.0.4 but when I upgrade to 2.1.X and rebuild I get the "false" compile error. If I try to go back to 2.0.4, I continue to get that compile error and have to rebuild the entire environment from source control. I've upgrade to MyEclipse 2014 but am seeing the same error. – Dan Hunt Aug 20 '14 at 17:32
  • Please respond on the last paragraph of my answer. – BalusC Aug 20 '14 at 17:35
  • Problem resolved, I had to move the JSF jar up in the load order. – Dan Hunt Aug 20 '14 at 19:03
  • I put javax.faces-2.X as the first jar loaded and yes it was javaee.jar causing the compile error. When I checked out from source control, the load order was correct, but when I added the new JSF jar it put it at the bottom of the order, so even when I switched back I still had the problem until I rebuilt from source control. Thanks for your help! – Dan Hunt Aug 21 '14 at 18:24
  • You're welcome. The `javaee.jar` should be replaced by the "Target Runtime". For a related answer, see also http://stackoverflow.com/questions/4076601/how-do-i-import-the-javax-servlet-api-in-my-eclipse-project – BalusC Aug 21 '14 at 18:25