You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by devmsaleh <de...@gmail.com> on 2013/07/26 14:40:52 UTC

org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling code

i have a junit test case that runs a code like:

    if (SecurityUtil.isAuthenticated()) { 
    
    }

and it gives an exception:

    org.apache.shiro.UnavailableSecurityManagerException: 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.

My Test Class configuration is as follows:

    @RunWith(SpringJUnit4ClassRunner.class)
    @TestExecutionListeners({ WebContextTestExecutionListener.class,
    		DependencyInjectionTestExecutionListener.class,
    		DirtiesContextTestExecutionListener.class,
    		TransactionalTestExecutionListener.class })
    @ActiveProfiles("test")
    @DirtiesContext
    @ContextConfiguration(loader = AnnotationConfigContextLoader.class,
classes = {
    		SpringConfig.class, SpringTestingConfig.class,
    		SpringLocalContainerJPAConfig.class, CustomConfiguration.class })
    public class MyTestClass { }

please advise how to fix this error, thanks.



--
View this message in context: http://shiro-user.582556.n2.nabble.com/org-apache-shiro-UnavailableSecurityManagerException-No-SecurityManager-accessible-to-the-calling-coe-tp7578954.html
Sent from the Shiro User mailing list archive at Nabble.com.