0

I want to include a prime-faces component (selectOneMenu) in a xhtml page. That component has originally been a normal jsf-component. I included prime-faces with: xmlns:p="http://primefaces.org/ui".

After the change I get the following error when loading the page: Property 'countryLocaleCodeChanged' not found on type logic.Internationalization.

I already tried to do the request with ajax, with the same result (property not found error).
Why do I get this error?

I use:

  • prime-faces 5.2
  • jsf 2.2
  • tomcat 8.0

Here are parts of the code:
.xhtml:

<h:form>
    <p:selectOneMenu id="languagemenu" 
        onchange="submit()"
        valueChangeListener="#{inter.countryLocaleCodeChanged}"
        value = "#{inter.localeCode}">
        <f:selectItems value="#{inter.countriesInMap}" /> 
    </p:selectOneMenu>
</h:form>


.java:

public void countryLocaleCodeChanged(ValueChangeEvent e){
    String newLocaleValue = e.getNewValue().toString();
    for (Map.Entry<String, Object> entry : countries.entrySet()) {
        if(entry.getValue().toString().equals(newLocaleValue)){
            FacesContext.getCurrentInstance().getViewRoot().setLocale((Locale)entry.getValue());
        }
    }
}


.stacktrace:

javax.el.ELException: /pageHome.xhtml: Property 'countryLocaleCodeChanged' not found on type logic.Internationalization
at com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:94)
at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

Thanks in advance

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • The culprit is not visible in the current question but send an asynchronous request, when an item (language) is changed in the given `` and then make a redirect from the associated managed bean after the locale has successfully been set to the current HTTP session. This `onchange="submit()"` otherwise, sends an unwanted synchronous POST request. – Tiny Jan 08 '16 at 14:15
  • 1
    @Tiny: no this is not related. As the error is in the facelets compiler and there is **no** PrimeFaces in the stacktrace **and** the error is in the `UIInstructions`, it means that the EL is interpreted as a value expression. This all comes down to PrimeFaces not being available in the webapp at runtime, – Kukeltje Jan 08 '16 at 14:48
  • At least that is what I have had before – Kukeltje Jan 08 '16 at 14:54
  • I included the prime-face jar via eclipse configure-build-path ... is this not suficient? – matthiasboesinger Jan 08 '16 at 15:25
  • Look for that JAR into the deployed WAR whether it is available there or not. Stop and start the server, clean & build / deploy the application all over again from scratch, if not. – Tiny Jan 08 '16 at 15:46
  • that was right! The answer could be found in the 'duplicated' question! – matthiasboesinger Jan 08 '16 at 19:27

0 Answers0