Announcement Announcement Module
Collapse
No announcement yet.
Error Creating bean Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error Creating bean

    Hi All,
    I am a day old with Acegi, an absolute newbie. And I am not able to solve a problem with daoAuthenticationManager.
    Attaching alongwith, the error dump, web.xml and application-context.xml


    Code:
    ERROR [jsp]:257 - Servlet.service() for servlet jsp threw exception
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationProcessingFilter' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'authenticationManager' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'daoAuthenticationProvider' while setting bean property 'providers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoAuthenticationProvider' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'userManager' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'userDao' while setting bean property 'SPUserHibernateDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.infosys.csp.sportsportal.dao.SPUserHibernateDAO]: Bean property 'sessionFactory' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'daoAuthenticationProvider' while setting bean property 'providers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoAuthenticationProvider' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'userManager' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'userDao' while setting bean property 'SPUserHibernateDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.infosys.csp.sportsportal.dao.SPUserHibernateDAO]: Bean property 'sessionFactory' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoAuthenticationProvider' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'userManager' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'userDao' while setting bean property 'SPUserHibernateDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.infosys.csp.sportsportal.dao.SPUserHibernateDAO]: Bean property 'sessionFactory' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'userDao' while setting bean property 'SPUserHibernateDAO'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.infosys.csp.sportsportal.dao.SPUserHibernateDAO]: Bean property 'sessionFactory' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.infosys.csp.sportsportal.dao.SPUserHibernateDAO]: Bean property 'sessionFactory' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
    org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.infosys.csp.sportsportal.dao.SPUserHibernateDAO]: Bean property 'sessionFactory' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
    	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:670)
    	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:572)
    	at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:737)
    	at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:764)
    	at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:753)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1057)


    I will appreciate any help in the above scenario asap. Application-context and web.xml in the next post.

    Many Thanks,
    Gaurav Awasthi

  • #2
    contd

    Application-context.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <!-- do not mess with this file -->
    <beans default-lazy-init="true">
      <!-- ======================== FILTER CHAIN ======================= -->
      <bean id="filterChainProxy"
        class="org.acegisecurity.util.FilterChainProxy">
        <property name="filterInvocationDefinitionSource">
          <value>
            CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
            PATTERN_TYPE_APACHE_ANT
          /**=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor
          </value>
        </property>
      </bean>
    
      <bean id="httpSessionContextIntegrationFilter"
        class="org.acegisecurity.context.HttpSessionContextIntegrationFilter" />
    
      <bean id="logoutFilter"
        class="org.acegisecurity.ui.logout.LogoutFilter">
        <constructor-arg value="/jsps/login.jsp" />
        <!-- URL redirected to after logout -->
        <constructor-arg>
          <list>
            <!--<ref bean="rememberMeServices" />
            --><bean
              class="org.acegisecurity.ui.logout.SecurityContextLogoutHandler" />
          </list>
        </constructor-arg>
        <property name="filterProcessesUrl" value="/jsps/Login.do" />
      </bean>
    
      <bean id="authenticationProcessingFilter"
        class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter">
        <property name="authenticationManager"
          ref="authenticationManager" />
        <property name="authenticationFailureUrl"
          value="/jsps/LoginFailed.jsp" />
        <property name="defaultTargetUrl" value="/jsps/login.jsp" />
        <property name="alwaysUseDefaultTargetUrl" value="true" />
        <property name="filterProcessesUrl" value="/j_security_check" />
      </bean>
      
      <bean id="rememberMeProcessingFilter"
        class="org.acegisecurity.ui.rememberme.RememberMeProcessingFilter">
        <property name="authenticationManager"
          ref="authenticationManager" />
        <property name="rememberMeServices" ref="rememberMeServices" />
      </bean>
      <bean id="anonymousProcessingFilter"
        class="org.acegisecurity.providers.anonymous.AnonymousProcessingFilter">
        <property name="key" value="anonymous" />
        <property name="userAttribute" value="anonymous,ROLE_ANONYMOUS" />
      </bean>
    
      <bean id="exceptionTranslationFilter"
        class="org.acegisecurity.ui.ExceptionTranslationFilter">
        <property name="authenticationEntryPoint">
          <bean
            class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
            <property name="loginFormUrl" value="/jsps/LoginFailed.jsp" />
            <property name="forceHttps" value="false" />
          </bean>
        </property>
      </bean>
    
      <bean id="filterInvocationInterceptor"
        class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
        <property name="authenticationManager"
          ref="authenticationManager" />
        <property name="accessDecisionManager"
          ref="accessDecisionManager" />
        <property name="objectDefinitionSource">
          <value>
            PATTERN_TYPE_APACHE_ANT
            /jsps/SearchGamePlay.jsp=Admin
            /jsps/login.jsp=ROLE_ANONYMOUS,Admin,LeagueOwner,TeamOwner,Member
            /**=admin,user        
          </value>
        </property>
      </bean>
    
      <bean id="accessDecisionManager"
        class="org.acegisecurity.vote.AffirmativeBased">
        <property name="allowIfAllAbstainDecisions" value="false" />
        <property name="decisionVoters">
          <list>
            <bean class="org.acegisecurity.vote.RoleVoter">
              <property name="rolePrefix" value="" />
            </bean>
          </list>
        </property>
      </bean>
    
      <bean id="rememberMeServices"
        class="org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices">
        <property name="userDetailsService" ref="userManager" />
        <property name="key" value="wisdom-key" />
        <property name="parameter" value="rememberMe" />
      </bean>
    
      <bean id="authenticationManager"
        class="org.acegisecurity.providers.ProviderManager">
        <property name="providers">
          <list>
            <ref bean="daoAuthenticationProvider" /><!--
            <ref local="anonymousAuthenticationProvider" />
            <ref local="rememberMeAuthenticationProvider" />
          --></list>
        </property>
      </bean>
    
      <bean id="daoAuthenticationProvider"
        class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
        <property name="userDetailsService" ref="userManager" />
      </bean>
    
      <bean id="anonymousAuthenticationProvider"
        class="org.acegisecurity.providers.anonymous.AnonymousAuthenticationProvider">
        <property name="key" value="anonymous" />
      </bean>
    
      <bean id="rememberMeAuthenticationProvider"
        class="org.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider">
        <property name="key" value="wisdom-key" />
      </bean>
    
    
      <!-- This bean is optional; it isn't used by any other bean as it only listens and logs -->
      <bean id="loggerListener"
        class="org.acegisecurity.event.authentication.LoggerListener" />
    
    
      <!-- SSL Switching: to use this, configure it in the filterChainProxy bean -->
      <bean id="channelProcessingFilter"
        class="org.acegisecurity.securechannel.ChannelProcessingFilter">
        <property name="channelDecisionManager"
          ref="channelDecisionManager" />
        <property name="filterInvocationDefinitionSource">
          <value>
            PATTERN_TYPE_APACHE_ANT
            /admin/**=REQUIRES_SECURE_CHANNEL
            /login*=REQUIRES_SECURE_CHANNEL
            /j_security_check*=REQUIRES_SECURE_CHANNEL
            /**=REQUIRES_INSECURE_CHANNEL
          </value>
        </property>
      </bean>
    
      <bean id="channelDecisionManager"
        class="org.acegisecurity.securechannel.ChannelDecisionManagerImpl">
        <property name="channelProcessors">
          <list>
            <bean
              class="org.acegisecurity.securechannel.SecureChannelProcessor" />
            <bean
              class="org.acegisecurity.securechannel.InsecureChannelProcessor" />
          </list>
        </property>
      </bean>
    <bean id="userManager" class="com.infosys.csp.sportsportal.services.impl.SPUserSearchServiceImpl">
    <property name="SPUserHibernateDAO">
          <ref bean="userDao"/>
        </property>
        <property name="SPRoleHibernateDAO">
          <ref bean="roleDao"/>
        </property>
    </bean>
    <bean id="factory"
    	class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"
    	lazy-init="false">
    	<property name="configLocation"
    		value="classpath:hibernate.cfg.xml">
    	</property>
    </bean>
    <bean id="userDao" class="com.infosys.csp.sportsportal.dao.SPUserHibernateDAO">
    <property name="sessionFactory"><ref bean="factory"/></property>
    </bean>
    <bean id="roleDao" class="com.infosys.csp.sportsportal.dao.SPRoleHibernateDAO">
    <property name="sessionFactory"><ref bean="factory"/></property>
    </bean>
    </beans>

    Comment


    • #3
      contd

      web.xml

      Code:
      <?xml version="1.0" encoding="ISO-8859-1"?>
      
      <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
        "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
      
      <web-app>
        	<display-name>Mera Sportz Application</display-name>
      	<context-param>
      		<param-name>contextConfigLocation</param-name>
      		<param-value>
      			/WEB-INF/applicationContext.xml
      			/WEB-INF/applicationContext-web.xml
      		</param-value>
      	</context-param>
      	<filter>
      		<filter-name>securityFilter</filter-name>
      		<filter-class>
      			org.acegisecurity.util.FilterToBeanProxy
      		</filter-class>
      		<init-param>
      			<param-name>targetBean</param-name>
      			<param-value>filterChainProxy</param-value>
      			<!--<param-value>
      				org.acegisecurity.util.FilterChainProxy
      				</param-value>
      			-->
      		</init-param>
      	</filter>
      	<filter-mapping>
      		<filter-name>securityFilter</filter-name>
      		<url-pattern>/*</url-pattern>
      	</filter-mapping>
      
         <filter>
            <filter-name>LoginFilter</filter-name>
            <filter-class>com.infosys.csp.sportsportal.action.LoginFilter</filter-class>
            <init-param>
               <param-name>login.page</param-name>
               <param-value>/jsps/index.jsp</param-value>
            </init-param>
         </filter>
         
         <filter>
            <filter-name>XssFilter</filter-name>
            <filter-class>com.infosys.csp.sportsportal.action.XssFilter</filter-class>
         </filter>   
            
          <filter-mapping>
               <filter-name>XssFilter</filter-name>
               <url-pattern>/*</url-pattern>
          </filter-mapping>      
          <filter-mapping>
               <filter-name>LoginFilter</filter-name>
               <url-pattern>*.do</url-pattern>
          </filter-mapping>
          
          <listener>
              <listener-class>com.infosys.csp.sportsportal.util.SPSessionListener</listener-class>
          </listener>
      	
      	<listener>
      		<listener-class>
      			org.springframework.web.context.ContextLoaderListener
      		</listener-class>
      	</listener>
      
      	
      
        
        <!-- Standard Action Servlet Configuration (with debugging) -->
        <servlet>
          <servlet-name>action</servlet-name>
          <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
          <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/struts-config.xml</param-value>
          </init-param>
          <init-param>
            <param-name>debug</param-name>
            <param-value>2</param-value>
          </init-param>
          <init-param>
            <param-name>detail</param-name>
            <param-value>2</param-value>
          </init-param>
          <load-on-startup>2</load-on-startup>
        </servlet>
      
      
        <!-- Standard Action Servlet Mapping -->
      
      
        <!-- JSPC servlet mappings start -->
      
      <!-- JSPC servlet mappings end -->
      
        <servlet-mapping>
          <servlet-name>action</servlet-name>
          <url-pattern>*.do</url-pattern>
        </servlet-mapping>
      
      
        <!-- The Usual Welcome File List -->
        <welcome-file-list>
          <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
      
      
        <!-- Struts Tag Library Descriptors -->
        <taglib>
          <taglib-uri>/tags/struts-bean</taglib-uri>
          <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
        </taglib>
      
        <taglib>
          <taglib-uri>/tags/struts-html</taglib-uri>
          <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
        </taglib>
      
        <taglib>
          <taglib-uri>/tags/struts-logic</taglib-uri>
          <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
        </taglib>
      
        <taglib>
          <taglib-uri>/tags/struts-nested</taglib-uri>
          <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
        </taglib>
      
        <taglib>
          <taglib-uri>/tags/struts-tiles</taglib-uri>
          <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
        </taglib>
      	<error-page>
         <exception-type> java.lang.Exception </exception-type>
         <location>/jsps/Error.jsp</location>
      	</error-page>
      
      </web-app>

      Comment


      • #4
        Have you read the exception message?

        "Bean property 'sessionFactory' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?"

        com.infosys.csp.sportsportal.dao.SPUserHibernateDA O is your class so it's Spring/hibernate configuration isn't really an Acegi issue.

        Comment

        Working...
        X