Reputation: 3119
i'm using the Apache Shiro as the framework for athetication of my application. I was following the reference at http://www.grails.org/plugin/shiro and my application throws the exception:
No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton. This is an invalid application configuration.
java.lang.IllegalStateException: No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton. This is an invalid application configuration. at org.apache.shiro.SecurityUtils.getSecurityManager(SecurityUtils.java:115) at org.apache.shiro.SecurityUtils.getSubject(SecurityUtils.java:57) at br.netsoft.ShiroDbRealmTests.testAutenticarComDadosCorretos(ShiroDbRealmTests.groovy:58) at junit.framework.Test$run.call(Unknown Source)
What i can do?
Upvotes: 4
Views: 2179
Reputation: 130
I was getting this exception in unit test framework for grails app. I initialized the security service in setUp method and test test-framework no more getting this exception
@Before
void setUP(){
new org.apache.shiro.grails.ShiroSecurityService()
}
Upvotes: 0
Reputation: 4788
This seems to be a known issue - see http://jira.codehaus.org/browse/GRAILSPLUGINS-1980, there are a few suggested workarounds there. Also, this thread sheds some light on potential cause.
Upvotes: 1