Search code examples
grailsspring-securitygrails-plugin

ifNotLoggedIn tag - Grails 2.4.4/Spring Security 2.0-RC4 - Cannot get property 'securityConfig' on null object


Strange issue here. I have a sec:ifNotLogged in tag in my template gsp, and it fails with the error/stack trace below. However, if I remove the tag so that I can log in, then add it back after I'm logged in, it works fine. I have a plugin that extends the Spring Security plugin to add a REST authentication provider, but the same configuration worked on Grails 2.3.8 and Spring Security 2.0RC2.

Caused by GroovyPagesException: Error evaluating expression [SpringSecurityUtils.securityConfig.apf.filterProcessesUrl] on line [46]: Cannot get property 'securityConfig' on null object
->>   46 | doCall    in /grails-app/views/layouts/main.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Caused by NullPointerException: Cannot get property 'securityConfig' on null object
->>   46 | doCall    in Users_dustin_Documents_svn_Company_svn_trunk_app_grails_app_views_layouts_main_gsp$_run_closure2_closure26_closure51
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    145 | doCall    in grails.plugin.springsecurity.SecurityTagLib$_closure7
|     57 | doCall .  in Users_dustin_Documents_svn_Company_svn_trunk_app_grails_app_views_layouts_main_gsp$_run_closure2
|    101 | run       in Users_dustin_Documents_svn_Company_svn_trunk_app_grails_app_views_layouts_main_gsp
|    198 | doFilter  in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter  in grails.plugin.cache.web.filter.AbstractFilter
|     53 | doFilter  in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
|     49 | doFilter  in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
|     82 | doFilter  in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    744 | run       in java.lang.Thread

Solution

  • User error. Reference to the old package for SpringSecurityUtils in the template within the body of the tag.