在使用SpringSecurity3.0.4時出現以下異常,
[orm:15:07:17] ERROR [main] ContextLoader.initWebApplicationContext(220) | Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChainProxy': Cannot resolve reference to bean 'filterSecurityInterceptor' while setting bean property 'filterChainMap' with key [/**] with key [9]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filterSecurityInterceptor' defined in file [E:\workshop\eclipse_jee\info_platform\target\classes\applicationContext-security.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Unsupported configuration attributes: [數據模塊]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filterSecurityInterceptor' defined in file [E:\workshop\eclipse_jee\info_platform\target\classes\applicationContext-security.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Unsupported configuration attributes: [數據模塊]
2010-12-02 15:07:17.952:WARN::Failed startup of context org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@a40050{/info_platform,E:\workshop\eclipse_jee\info_platform\src\main\webapp}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChainProxy': Cannot resolve reference to bean 'filterSecurityInterceptor' while setting bean property 'filterChainMap' with key [/**] with key [9]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filterSecurityInterceptor' defined in file [E:\workshop\eclipse_jee\info_platform\target\classes\applicationContext-security.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Unsupported configuration attributes: [數據模塊]
2010-12-02 15:07:17.952:WARN::Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChainProxy': Cannot resolve reference to bean 'filterSecurityInterceptor' while setting bean property 'filterChainMap' with key [/**] with key [9]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filterSecurityInterceptor' defined in file [E:\workshop\eclipse_jee\info_platform\target\classes\applicationContext-security.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Unsupported configuration attributes: [數據模塊]:
緣由:
原來是SpringSecurity3的配置文件applicationContext-security.xml中已經設置了
「將受權名稱的默認前綴由ROLE_改成A_」,這樣的話,則配置的權限名稱是以下樣子的:
A_瀏覽用戶
A_新增用戶
A_修改用戶
A_刪除用戶
,而我在數據庫中保存配置的權限名稱是「瀏覽用戶」,一看就知道是沒有加上受權名稱的前綴,
因此啓動時會報上述錯誤!!!
解決辦法:
將數據庫中保存的權限名稱前加上「A_」便可!!!java