Hi --

In my web application, I am trying to run a daemon task.  This task is run
in the same JVM but 
from outside the normal web/servlet processing.

I am attempting to create a subject and bind it to this task like this:

    Subject subject = new Subject.Builder().buildSubject();

    ThreadState state = new SubjectThreadState(subject);
    state.bind();
    try {
        // run tasks
    } finally {
        state.clear();
    }

but it throws this:

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.
    at
org.apache.shiro.SecurityUtils.getSecurityManager(SecurityUtils.java:123)

when it is building the subject.

I believe I would like Shiro to use the exact, same SecurityManager that all
the standard processing uses, which is DefaultWebSecurityManager, but I
don't understand how to initialize this "thread" to use it.  I have read
through the documentation and have I tried variations of
SecurityUtils.setSecurityManger() with no luck.

Thanks much,
Dan 

--
View this message in context: 
http://shiro-user.582556.n2.nabble.com/Daemon-Task-tp6292830p6292830.html
Sent from the Shiro User mailing list archive at Nabble.com.

Reply via email to