Dec 7th, 2011, 05:54 PM
ACL Configuration with SpEL - NullPointer
I'm fairly new to Spring (and Spring Security) - currently reading the unofficial book. (Excuses in advance )
I tried setting up ACL for a dummy application, however - it does not seems to work ... I want to make use of the hasPermission() checks and SpEL.
However, when I deploy this configuration/application on Tomcat7, I receive a NullPointer Exception.
My application context: http://pastebin.com/tkHgbKWM
The stacktrace: http://pastebin.com/6M4gFV4H
Any ideas? What am I doing wrong? What am I missing?
Thank you in advance,
Dec 8th, 2011, 11:13 AM
The NullPointerException occurs when trying to initialize SortedResourcesFactoryBean for ResourceDatabasePopulator which is created with the embedded-database tag. I would double check that acl-schema.sql is available on the classpath.
PS: In the future please post configuration and stacktraces to the forums using the code tags rather than using pastebin. This is preferred so that when others try to search the forums for answers it is more easily found.
Dec 8th, 2011, 06:46 PM
I believe the nullpointer was a missing maven dependency. I managed to get past it anyway.
However, right now I receive a runtime Exception for my @PreAuthorize annotation
"An Authentication object was not found in the SecurityContext"
I think this exception is normal, however - I also believe it should turn into an access denied as soon as I configure anonymous authorization. I think I did this, but the exception is not going away.
I attached my full project, to make it easier to look at my code/configuration.
edit: I just wanted to point out that STS is complaining about deprecated warnings on my <http> namespace configuration.
Dec 9th, 2011, 06:18 AM
I managed to fix it after a long night of sleep.
Didnt have a springSecurityFilterChain configured in my web.xml, once I did that - it all started working.
Thank you all!