注意:这个问题仍然没有正确答案!
我使用Spring Security 2.0RC5和ACL 2RC2运行Grails 2.4.5。当我使用ROLE_ADMIN和ROLE_USER帐户登录时,有时会出现以下错误。
2015-08-28 16:05:17,994 [http-nio-8080-exec-7] ERROR [/majestella].[grails] - Servlet.service() for servlet grails threw exception
Message: Unable to find ACL information for object identity 'org.springframework.security.acls.domain.ObjectIdentityImpl[Type: majestella.Company; Identifier: 50e396b8eebefc5a84]'
Line | Method
->> 292 | readAclsById in grails.plugin.springsecurity.acl.AclService
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 38 | myhotels in majestella.admin.AdminHotelController
| 198 | doFilter . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 32 | doCall . . . . . in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_gsp$_run_closure2
| 39 | run in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_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
| 62 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 46 | doFilterInternal in org.grails.jaxrs.web.JaxrsFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Error |
2015-08-28 16:05:18,035 [http-nio-8080-exec-7] ERROR errors.GrailsExceptionResolver - NotFoundException occurred when processing request: [GET] /majestella/admin
Unable to find ACL information for object identity 'org.springframework.security.acls.domain.ObjectIdentityImpl[Type: majestella.Company; Identifier: 50e396b8eebefc5a84]'. Stacktrace follows:
Message: Error processing GroovyPageView: Error executing tag <g:include>: Unable to execute include: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [myhotels] of controller [majestella.admin.AdminHotelController] caused exception: Runtime error executing action
Line | Method
->> 527 | doFilter in /grails-app/views/admin/index.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:include>: Unable to execute include: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [myhotels] of controller [majestella.admin.AdminHotelController] caused exception: Runtime error executing action
->> 32 | doCall in /grails-app/views/admin/index.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by ControllerExecutionException: Unable to execute include: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [myhotels] of controller [majestella.admin.AdminHotelController] caused exception: Runtime error executing action
->> 32 | doCall in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_gsp$_run_closure2
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 39 | run in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_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
| 62 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 46 | doFilterInternal in org.grails.jaxrs.web.JaxrsFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [myhotels] of controller [majestella.admin.AdminHotelController] caused exception: Runtime error executing action
->> 116 | logThrowable in grails.plugin.cache.web.filter.AbstractFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 70 | doFilter in ''
| 32 | doCall . . . . . in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_gsp$_run_closure2
| 39 | run in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_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
| 62 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 46 | doFilterInternal in org.grails.jaxrs.web.JaxrsFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by ControllerExecutionException: Executing action [myhotels] of controller [majestella.admin.AdminHotelController] caused exception: Runtime error executing action
->> 198 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 32 | doCall . . . . . in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_gsp$_run_closure2
| 39 | run in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_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
| 62 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 46 | doFilterInternal in org.grails.jaxrs.web.JaxrsFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by ControllerExecutionException: Runtime error executing action
->> 198 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 32 | doCall . . . . . in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_gsp$_run_closure2
| 39 | run in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_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
| 62 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 46 | doFilterInternal in org.grails.jaxrs.web.JaxrsFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by InvocationTargetException: null
->> 198 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 32 | doCall . . . . . in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_gsp$_run_closure2
| 39 | run in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_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
| 62 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 46 | doFilterInternal in org.grails.jaxrs.web.JaxrsFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by NotFoundException: Unable to find ACL information for object identity 'org.springframework.security.acls.domain.ObjectIdentityImpl[Type: majestella.Company; Identifier: 50e396b8eebefc5a84]'
->> 292 | readAclsById in grails.plugin.springsecurity.acl.AclService
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 38 | myhotels in majestella.admin.AdminHotelController
| 198 | doFilter . . . . in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 32 | doCall . . . . . in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_gsp$_run_closure2
| 39 | run in Users_mg_Documents_Grails_GGTS3_6_4_Server_majestella_grails_app_views_admin_index_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
| 62 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
| 46 | doFilterInternal in org.grails.jaxrs.web.JaxrsFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
在同一页面上使用带有ROLE_USER的帐户我没有收到此错误。
当我重新启动服务器时,ROLE_ADMIN和ROLE_USER用户的错误消失了。可能存在一些缓存问题。
如何解决此错误?
编辑:这是我要求的GSP:
some html code
<g:include controller="adminUser" action="myUsers" />
我的控制器使用Spring Security Annotation:
@Secured(AccessRole.ROLE_USER)
class AdminController {
def index() {}
}
编辑:以下是我包含的GSP的内容:
<%@ page import="test.Hotel" %>
<g:each in="${hotels}" var="hotel">
<g:render template="hotel" model="[hotel: hotel]" />
</g:each>
答案 0 :(得分:2)
至少我还需要看你的GSP,但我敢打赌你的问题与<g:include>
的使用以及你如何使用SpringSecurity有关。
您是否可以尝试从网页中删除<g:include>
代码并再次运行测试?
问题在于Spring Security是使用Servlet过滤器实现的,并且您在检查后包含了安全内容。
可能的解决方法:
例如,将带有spring安全标记的 includes 括起来,仅显示用户是否具有正确的角色:
<sec:ifAnyGranted roles="ROLE_USER">
<g:include controller="adminUser" action="myUsers" />
</sec:ifAnyGranted>
[]&#39; S
答案 1 :(得分:1)
Message: Unable to find ACL information for object identity 'org.springframework.security.acls.domain.ObjectIdentityImpl[Type: majestella.Company; Identifier: 50e396b8eebefc5a84]'
您尚未在数据库中为majestella.Company
创建标识为50e396b8eebefc5a84
的acl条目。每条记录都需要在acl条目和相关表上注册其权限。
答案 2 :(得分:0)
我仍然没有回答这个问题,但作为解决方法,我删除了:
<g:include controller="adminUser" action="myUsers" />