Exception with EL-Injections

Splash Forums PrettyFaces Users Exception with EL-Injections

This topic contains 5 replies, has 2 voices, and was last updated by  Christian Kaltepoth 5 years, 1 month ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #18657

    Hello,

    I’m currently trying to setup a URL containing a locale to load a certain language.

    But as soon, as i try to inject a parameter into a bean, an exception is thrown.

    I have a simple Bean : CurrentUser, like that:

    import java.io.Serializable;

    import javax.faces.bean.RequestScoped;
    import javax.inject.Named;

    @Named
    @RequestScoped
    public class CurrentUser implements Serializable {

    private static final long serialVersionUID = 1L;

    //FIXME: Remove default value, handle NULLPointer.
    private String username = "default";
    private String language = "default";

    public String getUsername() {
    return username;
    }

    public void setUsername(String username) {
    this.username = username;
    }

    public String getLanguage() {
    return language;
    }

    public void setLanguage(String language) {
    this.language = language;
    }
    }

    and setup that pretty-config.xml:

    <url-mapping id="portal">
    <pattern value="/portal/" />
    <view-id value="/faces/index_old.xhtml" />
    <query-param name="language">#{currentUser.language}</query-param>
    </url-mapping>

    calling http://… /portal/?language=en

    throws an Exception:

    PrettyFaces: Exception occurred while processing mapping portal:#{currentUser.language} for query parameter named language null

    (ofc i want to switch to /en/portal later – but it even did not work with query-params :-( )

    Any hints?

    StackTrace:

    com.ocpsoft.pretty.PrettyException: PrettyFaces: Exception occurred while processing mapping<portal:#{currentUser.language}> for query parameter named<language> null

    at com.ocpsoft.pretty.faces.beans.ParameterInjector.injectQueryParams(ParameterInjector.java:154)

    at com.ocpsoft.pretty.faces.beans.ParameterInjector.injectParameters(ParameterInjector.java:55)

    at com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:102)

    at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)

    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)

    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)

    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:329)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:112)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:840)

    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:622)

    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:560)

    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:488)

    at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:137)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

    at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)

    at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)

    at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)

    at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)

    at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:380)

    at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)

    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)

    at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:161)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)

    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)

    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)

    at org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:155)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)

    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:368)

    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)

    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)

    at java.lang.Thread.run(Thread.java:662)

    Caused by: java.lang.NullPointerException

    at com.ocpsoft.pretty.faces.beans.ParameterInjector.injectQueryParams(ParameterInjector.java:125)

    … 45 more

    #22867

    Which version of PrettyFaces are you using?

    #22868

    latest, 3.3.3 (installed today, via maven)

    #22869

    okay, i managed to find the problem. Its not prettyFaces.

    Co-Developer is currently doing some testing with a custom EL-Resolver, and the getType Method is returning null, which causes the exception in prettyFaces.

    #22870

    Hmmm. That’s really weird. It seems like this happens while PrettyFaces is trying to get the type of the property references by the EL expression.

    Could you perhaps set the debugging level for “com.ocpsoft.pretty.faces” to “TRACE” and post the log?

    #22871

    Oh, sorry, I should have refreshed the page before writing my post. :)

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Comments are closed.