2 Replies Latest reply on Jan 12, 2011 10:58 AM by Tiago Rico

    NPE JBossWebRealm.hasRole Line 537

    Paul Carroll Newbie

      I am using JBoss 5.1.0 GA with JDK 1.6_16. I have a menu bar at the top of each of my JSPs. It performs a check to determine the roles a user is a member. Based on this information, the user will see certain links on the menu bar. However, when navigating through the pages, the following is displayed in the log:

      2009-11-03 11:26:11,363 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/].[jsp]] Servlet.service() for servlet jsp threw exception
      java.lang.NullPointerException
       at org.jboss.web.tomcat.security.JBossWebRealm.hasRole(JBossWebRealm.java:537)
       at org.apache.catalina.connector.Request.isUserInRole(Request.java:2198)
       at org.apache.catalina.connector.RequestFacade.isUserInRole(RequestFacade.java:763)
       at javax.servlet.http.HttpServletRequestWrapper.isUserInRole(HttpServletRequestWrapper.java:164)
       at javax.servlet.http.HttpServletRequestWrapper.isUserInRole(HttpServletRequestWrapper.java:164)
       at javax.servlet.http.HttpServletRequestWrapper.isUserInRole(HttpServletRequestWrapper.java:164)
       at org.apache.struts.taglib.logic.PresentTag.condition(PresentTag.java:160)
       at org.apache.struts.taglib.logic.PresentTag.condition(PresentTag.java:102)
       at org.apache.struts.taglib.logic.ConditionalTagBase.doStartTag(ConditionalTagBase.java:218)
       at org.apache.jsp.jsp.common.mainMenuBar_jsp._jspService(mainMenuBar_jsp.java:214)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:638)
       at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:543)
       at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:480)
       at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
       at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:611)
       at org.apache.struts.taglib.template.GetTag.doStartTag(GetTag.java:191)
       at org.apache.jsp.jsp.common.topNavTemplate_jsp._jspx_meth_template_005fget_005f0(topNavTemplate_jsp.java:257)
       at org.apache.jsp.jsp.common.topNavTemplate_jsp._jspService(topNavTemplate_jsp.java:108)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:638)
       at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:543)
       at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:480)
       at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
       at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:611)
       at org.apache.struts.taglib.template.InsertTag.doEndTag(InsertTag.java:155)
       at org.apache.jsp.jsp.error._404_jsp._jspx_meth_template_005finsert_005f0(_404_jsp.java:194)
       at org.apache.jsp.jsp.error._404_jsp._jspService(_404_jsp.java:108)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:638)
       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:446)
       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382)
       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:310)
       at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:416)
       at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:342)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
       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)
      


      Sometimes the page will not display but when I refresh the page it displays fine. The error still is logged even during the refresh. Also, the appropriate links are displayed in the menu bar.

      I also tried replacing the jboss-web-service.jar from the attachment at https://jira.jboss.org/jira/browse/JBAS-7179 but this caused the app server to fail on startup. Just wondering if someone else ran into the problem and found a solution. Thanks.