Announcement Announcement Module
No announcement yet.
<security:authentication> gives exception after some time Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • <security:authentication> gives exception after some time

    I have used following in my jsp. to display user name in JSP.

    <%@ taglib prefix="security" uri="" %>

    <security:authentication property="principal.username" />

    when I am not using my system for more than 30 minutes and session is automatically expired, if i try to use click on any link, i got following exception.

    SEVERE: Servlet.service() for servlet jsp threw exception
    org.springframework.beans.NotReadablePropertyExcep tion: Invalid property 'principal.username' of bean class

    [ nonymousAuthenticationToken]: Bean property 'principal.username' is not readable
    getter match the parameter type of the setter?
    at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(
    at org.springframework.beans.BeanWrapperImpl.getPrope rtyValue(
    at icationTag.doEndTag(
    at org.apache.jsp.decorators.wideTemplate_jsp._jspx_m eth_security_005fauthentication_005f0(wideTemplate
    at org.apache.jsp.decorators.wideTemplate_jsp._jspSer vice(
    at org.apache.jasper.runtime.HttpJspBase.service(Http
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
    at org.apache.jasper.servlet.JspServletWrapper.servic e(
    at org.apache.jasper.servlet.JspServlet.serviceJspFil e(
    at org.apache.jasper.servlet.JspServlet.service(JspSe
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
    at ternalDoFilter(
    at Filter(
    at org.apache.catalina.core.ApplicationDispatcher.inv oke(
    at org.apache.catalina.core.ApplicationDispatcher.doI nclude(
    at lude(
    at com.opensymphony.sitemesh.compatability.OldDecorat or2NewDecorator.render(OldDecorator2NewDecorator.j ava:46)
    at com.opensymphony.sitemesh.webapp.decorator.BaseWeb AppDecorator.render(
    at Filter(
    at ternalDoFilter(
    at Filter(
    at sionInViewFilter.doFilterInternal(OpenSessionInVie
    at org.springframework.web.filter.OncePerRequestFilte r.doFilter(
    at ternalDoFilter(
    at Filter(
    at org.tuckey.web.filters.urlrewrite.RuleChain.handle Rewrite(
    at org.tuckey.web.filters.urlrewrite.RuleChain.doRule s(
    at org.tuckey.web.filters.urlrewrite.UrlRewriter.proc essRequest(
    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter .doFilter(
    at ternalDoFilter(
    at Filter(
    at org.springframework.web.filter.HiddenHttpMethodFil ter.doFilterInternal( 1)

  • #2
    Use [ code][/code ] tags when posting code.

    Your principal is replaced due to a session time-out with a anonymous one which doesn't have a username. Make sure you use that only in pages which are accessible by authenticated users else you will get these exceptions. Or check if a user is fully authenticated instead of anonymous.