1 Reply Latest reply on Mar 1, 2011 11:58 PM by Tim Evers

    NPE as ELException during rendering the page

    Shi Zuma Newbie

      Hi,


      maybe someone already faced this problem an knows what could be the problem :).


      Sometimes when a page gets loaded, I receive this NPE


      14:00:49,276 INFO  [STDOUT] 14:00:49,276 ERROR [Exceptions          ] handled and logged exception
      javax.el.ELException: java.lang.NullPointerException
              at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:339)
              at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
              at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
              at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
              at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
              at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:175)
              at org.jboss.seam.navigation.Page.preRender(Page.java:311)
              at org.jboss.seam.navigation.Pages.preRender(Pages.java:350)
              at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:561)
              at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:472)
              at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:148)
              at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118)
              at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
              at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
              at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
              at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
              at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
              at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.NullPointerException
      



      I have no clue which expression raises the NPE and also why it only happens 'sometimes' ... :/


      Every help is appreciated - thx!

        • 1. Re: NPE as ELException during rendering the page
          Tim Evers Master

          I don't know the reason behind the exception however, I do have a suggestion so that you can get closer to the answer.


          In your IDE (I use eclipse but, I know it is possible in other IDEs such as IDEA) you can set up exception break points.


          This breakpoint is a special type of break point that will pause the stack at the point where the selected exception is raised.


          In eclipse open the breakpoints view and there is a button that looks like 'J!' (The J is slightly smaller and up to the left of the !). Click on this and choose the NullPointerException in the list. Then remotely connect to your app.


          Doing this requires you to boot tomcat with some extra params


          -Xdebug
          -Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=n
          



          The address=5000 tells you what port you should connect to.


          Once you have booted Tomcat with these options you can debug remote connect to it in eclipse. To do this.



          1. Open the debug configurations menu.

          2. Create a new Remote Java Application configuration

          3. Fill in name to your choice

          4. Make sure the correct project source base is selected

          5. Connection Type = Standard (Socket Attach)

          6. Host is straight forward eg localhost or 192.168.0.5 or whatever your hostname is

          7. Port will be 5000 unless you changed the number of the address property earlier in which case that number.

          8. Click Apply

          9. Click Debug (As long as you booted tomcat right with the params it should now connect and allow you to use the break point I told you about earlier).



          Then all you need to do is keep using the app until that break point fires and then click through your stack and inspect the EL expression that is being evaluated. Hopefully, this will give you some more info that will help.