jacekn
jacekn

Reputation: 1541

What does error NoSuchFieldException in Spring means?

2723 [Thread-1] DEBUG org.springframework.core.env.StandardEnvironment  - Adding [systemEnvironment] PropertySource with lowest search precedence
2723 [Thread-1] DEBUG org.springframework.core.env.StandardEnvironment  - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
2725 [Thread-1] DEBUG org.springframework.beans.BeanUtils  - No property editor [org.springframework.security.web.authentication.logout.LogoutSuccessHandlerEditor] found for type org.springframework.security.web.authentication.logout.LogoutSuccessHandler according to 'Editor' suffix convention
2726 [Thread-1] DEBUG org.springframework.beans.TypeConverterDelegate  - **Field [/admin/login] isn't an enum value**
java.lang.NoSuchFieldException: /admin/login
    at java.lang.Class.getField(Class.java:1537)
    at org.springframework.beans.TypeConverterDelegate.attemptToConvertStringToEnum(TypeConverterDelegate.java:287)
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:218)
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:92)
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:451)

I have /admin/login as a mapping in one controller:

@RequestMapping(value="/admin/login", method=RequestMethod.GET)
public ModelAndView getLoginPage(@RequestParam(value="failedAttempt", required=false) boolean failedAttempt, ModelMap model) {

Other than that, this string is mentioned in the spring-security.xml.

This error shows up when my server starts up. I'm not even going to /admin/login page.

My security xml.

    <security:intercept-url pattern="/admin/login" access="permitAll"/>
    <security:intercept-url pattern="/admin/denied" access="permitAll"/>
    <security:intercept-url pattern="/admin/logout" access="permitAll"/>
    <security:intercept-url pattern="/admin/*" access="hasRole('AUTHOR')"/>
    <security:intercept-url pattern="/admin**" access="hasRole('AUTHOR')"/>
    <security:form-login 
        login-page="/admin/login" 
        login-processing-url="/admin/j_spring_security_check" 
        authentication-failure-url="/admin/login?failedAttempt=true"
        default-target-url="/admin/home"/>

        <security:logout
            invalidate-session="true"
            logout-success-url="/admin/login"
            logout-url="/admin/logout"/>
</security:http>

Upvotes: 4

Views: 5177

Answers (1)

Dave Syer
Dave Syer

Reputation: 58114

There is no error. Only a stack trace at debug level where Spring is trying to locate the right constructor for the login success handler (the default has 2 constructors and only one will match the String provided as an argument, i.e. "/admin/login"). You can ignore it or you can switch it off (debug logging at that level is not often very helpful, and you probably wouldn't want it on in production).

Upvotes: 5

Related Questions