Announcement Announcement Module
Collapse
No announcement yet.
[Spring 2.0.8] Error: No bean named '' is defined Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Spring 2.0.8] Error: No bean named '' is defined

    Hi,

    I tried to create a simple as possible application with spring security.

    I have 3 html pages (secured.html,unsecured.html,and accessdenied.html - which I all put outside and same level of WEB-INF), and an xml to specify the security (springSecurity.xml at WEB-INF folder).

    Functionality: I have one secured page (secured.html), which requires the specified role mentioned in springSecurity.xml. All implementations used are from spring (voters, authentication manager, etc.). In-memory dao authentication is used.

    I am getting the error:
    =======
    org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named '' is defined
    =======
    The entire error dump, and my spring and web.xml are below (the hmtls i made are simple htmls with one liners only).

    (I am deploying on jboss 4.2.3. Some chunks of codes I used are from Spring in Action book.)

    I will really appreciate any ideas.

    The web.xml:
    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>   
      
      
    <!DOCTYPE web-app PUBLIC   
        "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"  
        "http://java.sun.com/dtd/web-app_2_3.dtd">   
      
    <web-app>   
        <display-name>Blank Application</display-name>   
      
        <context-param>   
            <param-name>contextConfigLocation</param-name>   
            <param-value>/WEB-INF/springSecurity.xml</param-value>   
        </context-param>   
      
      
        <filter>   
            <filter-name>Spring Security Filter Chain Proxy</filter-name>   
            <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>   
            <init-param>   
                <param-name>targetClass</param-name>   
                <param-value>org.acegisecurity.util.FilterChainProxy</param-value>   
            </init-param>   
        </filter>   
        <filter-mapping>   
            <filter-name>Spring Security Filter Chain Proxy</filter-name>   
            <url-pattern>/*</url-pattern>   
        </filter-mapping>   
      
        <listener>   
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>   
        </listener>   
      
    </web-app>

    The springSecurity.xml:
    Code:
    <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">   
      
    <beans>   
        <bean id="gameAuthenticationDao" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">   
            <property name="userMap">   
                <value><![CDATA[palmerd=4moreyears,disabled,ROLE_PRESIDENT   
                    bauerj=ineedsleep,ROLE_FIELD_OPS   
                    obrianc=nosmile,ROLE_SR_ANALYST,ROLE_OPS   
                    myersn=traitor,disabled,ROLE_CENTRAL_OPS]]></value>   
            </property>   
        </bean>   
      
        <bean id="gameDaoAuthenticationProvider"  
            class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">   
            <property name="userDetailsService" ref="gameAuthenticationDao" />   
        </bean>   
      
        <bean id="gameAuthenticationManager" class="org.acegisecurity.providers.ProviderManager">   
            <property name="providers">   
                <list>   
                    <ref bean="gameDaoAuthenticationProvider" />   
                </list>   
            </property>   
        </bean>   
      
        <bean id="roleVoter" class="org.acegisecurity.vote.RoleVoter" />   
      
        <bean id="gameAccessDecisionManager" class="org.acegisecurity.vote.UnanimousBased">   
            <property name="decisionVoters">   
                <list>   
                    <ref bean="roleVoter" />   
                </list>   
            </property>   
        </bean>   
      
      
        <bean id="httpSessionIntegrationFilter"  
            class="org.acegisecurity.context.HttpSessionContextIntegrationFilter" />   
      
        <bean id="gameAuthenticationEntryPoint"  
            class="org.acegisecurity.ui.basicauth.BasicProcessingFilterEntryPoint">   
            <property name="realmName" value="GamingCity" />   
        </bean>   
        <bean id="authenticationProcessingFilter" class="org.acegisecurity.ui.basicauth.BasicProcessingFilter">   
            <property name="authenticationManager" ref="gameAuthenticationManager" />   
            <property name="authenticationEntryPoint" ref="gameAuthenticationEntryPoint" />   
        </bean>   
      
        <bean id="exceptionTranslationFilter" class="org.acegisecurity.ui.ExceptionTranslationFilter">   
            <property name="authenticationEntryPoint" ref="gameAuthenticationEntryPoint" />   
        </bean>   
        <bean id="accessDeniedHandler" class="org.acegisecurity.ui.AccessDeniedHandlerImpl">   
            <property name="errorPage" value="/accessdenied.html" />   
        </bean>   
        <bean id="filterSecurityInterceptor"  
            class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">   
            <property name="authenticationManager" ref="gameAuthenticationManager" />   
            <property name="accessDecisionManager" ref="gameAccessDecisionManager" />   
            <property name="objectDefinitionSource">   
                <value>   
                    CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON   
                    PATTERN_TYPE_APACHE_ANT   
                    /secured.html=ROLE_PRESIDENT    
    </value>   
            </property>   
        </bean>   
      
        <bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy">   
            <property name="filterInvocationDefinitionSource">   
                <value><![CDATA[   
                    CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON   
                    PATTERN_TYPE_APACHE_ANT   
                    /**=httpSessionIntegrationFilter,   
                    authenticationProcessingFilter,   
                    exceptionTranslationFilter,   
                    filterSecurityInterceptor]]></value>   
            </property>   
        </bean>   
      
    </beans>
    The error dump:
    Code:
    03:32:18,115 INFO  [Server] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181439)] Started in 23s:854ms   
    03:36:09,769 ERROR [[default]] Servlet.service() for servlet default threw exception   
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '' is defined   
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:360)   
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:914)   
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:241)   
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)   
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:761)   
        at org.acegisecurity.util.FilterChainProxy.obtainAllDefinedFilters(FilterChainProxy.java:221)   
        at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:136)   
        at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)   
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)   
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)   
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)   
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)   
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)   
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)   
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)   
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)   
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)   
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)   
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)   
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)   
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)   
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)   
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)   
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)   
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)   
        at java.lang.Thread.run(Thread.java:619)

  • #2
    If you're new to Spring Security then I'd recommend you use the latest version and start with some of the sample applications so you have a working configuration. Acegi Security is now deprecated.

    Comment


    • #3
      Thank you for the tip.

      I am hoping to complete my study using this version as I am half-way on it already.

      Comment


      • #4
        Just want to share. I fixed it.

        I used game* as my bean names. I properly named and wired them. And I got this error that I posted.

        I changed them all to use the default bean names, and it is okay now:
        for example:
        instead of gameAuthenticationDao, I changed it to authenticationDao

        I think that I wired them properly when using game*. But anyway, I will let this go for now.

        Comment

        Working...
        X