No bean named 'shiroFilter' is defined
<p>I am current embeding Shiro into my <strong>Spring Web</strong> application.</p>

<p>In <code>web.xml</code>, I added:</p>

<pre><code>    &lt;filter&gt;
        &lt;filter-name&gt;shiroFilter&lt;/filter-name&gt;
        &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
        &lt;init-param&gt;
            &lt;param-name&gt;targetFilterLifecycle&lt;/param-name&gt;
            &lt;param-value&gt;true&lt;/param-value&gt;
        &lt;/init-param&gt;
    &lt;/filter&gt;

    &lt;filter-mapping&gt;
        &lt;filter-name&gt;shiroFilter&lt;/filter-name&gt;
        &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
    &lt;/filter-mapping&gt;
</code></pre>

<p>In <code>servlet-context.xml</code>, I added:</p>

<pre><code>    &lt;beans:bean id="shiroFilter" name="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"&gt;
        &lt;beans:property name="securityManager" ref="securityManager"/&gt;
        &lt;beans:property name="filterChainDefinitions"&gt;
            &lt;beans:value&gt;
                # some example chain definitions:
                /admin/** = authc, roles[admin]
                /docs/** = authc, perms[document:read]
                /** = authc
                # more URL-to-FilterChain definitions here
            &lt;/beans:value&gt;
        &lt;/beans:property&gt;
    &lt;/beans:bean&gt;

    &lt;beans:bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"&gt;
        &lt;beans:property name="realm" ref="myRealm"/&gt;
    &lt;/beans:bean&gt;

    &lt;beans:bean id="myRealm" class="com.hersbitcloud.cancercloud.ShiroRealm"&gt;

    &lt;/beans:bean&gt;
</code></pre>

<p>And because I haven't found a solution for the JDBD realm, so I am just using the <code>AuthenticatingRealm</code> as:</p>

<pre><code>public class ShiroRealm extends AuthenticatingRealm {

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken arg0) throws AuthenticationException {
        // TODO Auto-generated method stub
        return null;
    }
}
</code></pre>

<p>However, I got the following exception:</p>

<pre><code>org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'shiroFilter' is defined
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:698)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1175)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:284)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1057)
    at org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:326)
    at org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:235)
    at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:199)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
    at org.apache.catalina.core.ApplicationFilterConfig.&lt;init&gt;(ApplicationFilterConfig.java:105)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4640)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
</code></pre>

<p>How can I solve this?</p>

<p>Thank you.</p>