【问题标题】:Spring3, Security3: System works on windows but not Linux java.lang.IllegalArgumentExceptionSpring3,Security3:系统可以在 Windows 上运行,但不能在 Linux 上运行 java.lang.IllegalArgumentException
【发布时间】:2011-07-26 12:07:28
【问题描述】:

系统可以在 Windows 上运行,但不能在 Linux 上运行。我可以正常登录并列出数据,但是一旦我进入以下任何页面,我就会收到以下错误:

<http auto-config="true" use-expressions='true'>
        <intercept-url pattern="/friends/**" access="ROLE_USER" />
        <intercept-url pattern="/articles/**" access="ROLE_USER" />
</http>

java.lang.IllegalArgumentException

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.IllegalArgumentException: Failed to evaluate expression 'ROLE_USER'
    org.springframework.security.access.expression.ExpressionUtils.evaluateAsBoolean(ExpressionUtils.java:13)
    org.springframework.security.web.access.expression.WebExpressionVoter.vote(WebExpressionVoter.java:34)
    org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:50)
    org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:203)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:106)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

【问题讨论】:

    标签: java tomcat spring-mvc spring-security


    【解决方案1】:

    请参阅spring forum。表达式应该是 hasRole("ROLE_USER")

    【讨论】:

      【解决方案2】:

      在 Spring 3.0 中是 access="ROLE_USER"

      在 Spring 4.0 或更高版本中,为 access="hasRole('ROLE_USER')"

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-03-12
        • 1970-01-01
        • 2019-03-07
        • 1970-01-01
        • 1970-01-01
        • 2017-08-09
        • 2019-03-05
        相关资源
        最近更新 更多