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

  • UnknownAdviceTypeException

    Hello Guys!

    Im developing a spring applications that uses acegi. Im actually generating lot of the classes and xml descriptors with andromda.

    AndroMDA supports acegi but not since long, so there is mutch customization needed.

    After reading the acegi docs, I manage to configure and deploy a cas server that I would like to use for authentication purposes, it connects to a database to retrieve the principal data, the database tables are the ones proposed by acegi (5 tables).

    Im getting this error and dont know how to fix it, if you have any clues please let me know
    Code:
    GRAVE: Excepción enviando evento inicializado de contexto a instancia de escuchador de clase org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dpncSB' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unknown advisor type class net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor; Can only include Advisor or Advice type beans in interceptorNames chain except for last entry,which may also be target or TargetSource; nested exception is org.springframework.aop.framework.adapter.UnknownAdviceTypeException: Advice object [net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor@528780] is neither a supported subinterface of [org.aopalliance.aop.Advice] nor an [org.springframework.aop.Advisor]
    org.springframework.aop.framework.AopConfigException: Unknown advisor type class net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor; Can only include Advisor or Advice type beans in interceptorNames chain except for last entry,which may also be target or TargetSource; nested exception is org.springframework.aop.framework.adapter.UnknownAdviceTypeException: Advice object [net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor@528780] is neither a supported subinterface of [org.aopalliance.aop.Advice] nor an [org.springframework.aop.Advisor]
    org.springframework.aop.framework.adapter.UnknownAdviceTypeException: Advice object [net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor@528780] is neither a supported subinterface of [org.aopalliance.aop.Advice] nor an [org.springframework.aop.Advisor]
    Should I post my applicationContext* files here, that would be long, so im asking first :-)

  • #2
    Configuration Files (Long Post)

    Well,

    I assume that you'll need more info in order to help me so I'll paste my configuration IoC files here.

    applicationContext.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
    
        <!-- ========================= GENERAL DEFINITIONS ========================= -->
    
        <!-- Message source for this context, loaded from localized "messages_xx" files -->
        <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
            <property name="basename"><value>messages</value></property>
        </bean>
    
        <!-- applicationContext merge-point -->
    
        <!-- Hibernate SessionFactory -->
        <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
            <property name="dataSource"><ref bean="dataSource"/></property>
            <property name="mappingResources">
                <list>
                    <value>jupen/calcu/dpnc/Salarios.hbm.xml</value>
                    <value>jupen/calcu/dpnc/Choto.hbm.xml</value>
                    <value>jupen/calcu/dgjp/IPC.hbm.xml</value>
                </list>
            </property>
            <property name="hibernateProperties">
                <props>
                    <prop key="hibernate.show_sql">true</prop>
                    <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
                    <prop key="hibernate.default_schema">jupendb</prop>
                    <prop key="hibernate.cache.use_query_cache">false</prop>
                    <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
                    <prop key="hibernate.cache.query_cache_factory">org.hibernate.cache.StandardQueryCacheFactory</prop>
                </props>
            </property>
        </bean>
    
        <!-- The Hibernate interceptor -->
        <bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor">
            <property name="sessionFactory"><ref bean="sessionFactory"/></property>
        </bean>
    
        <!-- Salarios Entity Proxy with inner Salarios Entity implementation -->
        <bean id="salariosDao" class="org.springframework.aop.framework.ProxyFactoryBean">
            <property name="target">
                <bean class="jupen.calcu.dpnc.SalariosDaoImpl">
                    <property name="sessionFactory"><ref local="sessionFactory"/></property>
                </bean>
            </property>
            <property name="proxyInterfaces">
                <value>jupen.calcu.dpnc.SalariosDao</value>
            </property>
            <property name="interceptorNames">
                <list>
                    <value>hibernateInterceptor</value>
                </list>
            </property>
        </bean>
    
        <!-- Choto Entity Proxy with inner Choto Entity implementation -->
        <bean id="chotoDao" class="org.springframework.aop.framework.ProxyFactoryBean">
            <property name="target">
                <bean class="jupen.calcu.dpnc.ChotoDaoImpl">
                    <property name="sessionFactory"><ref local="sessionFactory"/></property>
                </bean>
            </property>
            <property name="proxyInterfaces">
                <value>jupen.calcu.dpnc.ChotoDao</value>
            </property>
            <property name="interceptorNames">
                <list>
                    <value>hibernateInterceptor</value>
                </list>
            </property>
        </bean>
    
        <!-- IPC Entity Proxy with inner IPC Entity implementation -->
        <bean id="iPCDao" class="org.springframework.aop.framework.ProxyFactoryBean">
            <property name="target">
                <bean class="jupen.calcu.dgjp.IPCDaoImpl">
                    <property name="sessionFactory"><ref local="sessionFactory"/></property>
                </bean>
            </property>
            <property name="proxyInterfaces">
                <value>jupen.calcu.dgjp.IPCDao</value>
            </property>
            <property name="interceptorNames">
                <list>
                    <value>hibernateInterceptor</value>
                </list>
            </property>
        </bean>
    
        <!-- ========================= Start of SERVICE DEFINITIONS ========================= -->
    
        <!-- Service Transactional Interceptor -->
        <bean id="serviceTransactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
            <property name="transactionManager"><ref bean="transactionManager"/></property>
            <property name="transactionAttributeSource">
                <value>
                    jupen.calcu.dpnc.DpncSB.cargarIPC=PROPAGATION_REQUIRED
                    jupen.calcu.dpnc.DpncSB.cargarSalario=PROPAGATION_REQUIRED
                    jupen.calcu.bpm.JbpmSB.createJbpmSchema=PROPAGATION_REQUIRED
                    jupen.calcu.bpm.JbpmSB.dropJbpmSchema=PROPAGATION_REQUIRED
                    jupen.calcu.bpm.JbpmSB.cleanJbpmSchema=PROPAGATION_REQUIRED
                </value>
            </property>
        </bean>
    
        <!-- DpncSB Service Proxy with inner DpncSB Service Implementation -->
        <bean id="dpncSB" class="org.springframework.aop.framework.ProxyFactoryBean">
            <property name="target">
                <bean class="jupen.calcu.dpnc.DpncSBImpl">
                    <property name="ipcDao"><ref bean="iPCDao"/></property>
                    <property name="salariosDao"><ref bean="salariosDao"/></property>
                </bean>
            </property>
            <property name="proxyInterfaces">
                <value>jupen.calcu.dpnc.DpncSB</value>
            </property>
            <property name="interceptorNames">
                <list>
                    <value>serviceSecurityInterceptor</value>
                    <value>serviceTransactionInterceptor</value>
                    <value>hibernateInterceptor</value>
                </list>
            </property>
        </bean>
    
        <!-- JbpmSB Service Proxy with inner JbpmSB Service Implementation -->
        <bean id="jbpmSB" class="org.springframework.aop.framework.ProxyFactoryBean">
            <property name="target">
                <bean class="jupen.calcu.bpm.JbpmSBImpl">
                </bean>
            </property>
            <property name="proxyInterfaces">
                <value>jupen.calcu.bpm.JbpmSB</value>
            </property>
            <property name="interceptorNames">
                <list>
                    <value>serviceSecurityInterceptor</value>
                    <value>serviceTransactionInterceptor</value>
                    <value>hibernateInterceptor</value>
                </list>
            </property>
        </bean>
    
        <!-- ========================= End of SERVICE DEFINITIONS ========================= -->
    
        <!-- ================= Start of ACEGI SERVICE SECURITY DEFINITIONS ================ -->
    
        <bean id="serviceSecurityInterceptor" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
            <property name="accessDecisionManager"><ref bean="serviceAccessDecisionManager"/></property>
            <property name="objectDefinitionSource">
                <value>
                    jupen.calcu.dpnc.DpncSB.cargarIPC=ROLE_Admin
                    jupen.calcu.dpnc.DpncSB.cargarSalario=ROLE_Admin
                    jupen.calcu.bpm.JbpmSB.createJbpmSchema=ROLE_Admin
                    jupen.calcu.bpm.JbpmSB.dropJbpmSchema=ROLE_Admin
                    jupen.calcu.bpm.JbpmSB.cleanJbpmSchema=ROLE_Admin
                </value>
            </property>
        </bean>
    
        <bean id="serviceAccessDecisionManager" class="net.sf.acegisecurity.vote.AffirmativeBased">
            <property name="allowIfAllAbstainDecisions">
                <value>false</value>
            </property>
            <property name="decisionVoters">
                <list>
                    <ref local="serviceDecisionVoter"/>
                </list>
            </property>
        </bean>
    
        <bean id="serviceDecisionVoter" class="net.sf.acegisecurity.vote.RoleVoter"/>
    
        <!-- ================== End of ACEGI SERVICE SECURITY DEFINITIONS ================= -->
    
    </beans>
    applicationContext-security.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
    
    <!--
    	Esta Configuración esta basada en lo provisto por Jens Vag de Deutschland
    -->
    <beans>
    	<!-- ServiceProperties bean definition -->
    	<bean id="serviceProperties" class="net.sf.acegisecurity.ui.cas.ServiceProperties">
    		<property name="service"><value>https&#58;//localhost&#58;8443/JupenCalcu</value></property>
    		<property name="sendRenew"><value>false</value></property>
    	</bean>
    	
    	<!-- Cas Porcessing Filter definition -->
    	<bean id="casProcessingFilter" class="net.sf.acegisecurity.ui.cas.CasProcessingFilter">
    		<property name="authenticationManager"><ref bean="authenticationManager"/></property>
    		<property name="authenticationFailureUrl"><value>/</value></property>
    		<property name="defaultTargetUrl"><value>/</value></property>
    		<property name="filterProcessesUrl"><value>/login</value></property> 
    	</bean>
    	
    	<!-- Security Enforcement Filter bean Definition -->
    	<bean id="securityEnforcementFilter" class="net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter">
    		<property name="filterSecurityInterceptor"><ref bean="filterInvocationInterceptor"/></property>
    		<property name="authenticationEntryPoint"><ref local="casProcessingFilterEntryPoint"/></property>
    	</bean>
    	
    	<!-- Cas Processing Filter Entry Point bean definition -->
    	<bean id="casProcessingFilterEntryPoint" class="net.sf.acegisecurity.ui.cas.CasProcessingFilterEntryPoint">
    		<property name="loginUrl"><value>https&#58;//localhost&#58;8443/cas/login</value></property>
    		<property name="serviceProperties"><ref local="serviceProperties"/></property>
    		
    	</bean>
    	
    	<!-- AuthenticationManager bean definition -->
    	<bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
    		<property name="providers">
    			<list>
    				<ref bean="casAuthenticationProvider"/>
    			</list>
    		</property>
    	</bean>
    	
    	<!-- CasAuthenticationProvider bean definition -->
    	<bean id="casAuthenticationProvider" class="net.sf.acegisecurity.providers.cas.CasAuthenticationProvider">
    		<property name="casAuthoritiesPopulator"><ref local="casAuthoritiesPopulator"/></property>
    		<property name="casProxyDecider"><ref bean="casProxyDecider"/></property>
    		<property name="ticketValidator"><ref bean="casProxyTicketValidator"/></property>
    		<property name="statelessTicketCache"><ref bean="statelessTicketCache"/></property>
    		<property name="key"><value>acegi</value></property>
    	</bean>
    	
    	<!-- CasProxyTicketValidator bean definition -->
    	<bean id="casProxyTicketValidator" class="net.sf.acegisecurity.providers.cas.ticketvalidator.CasProxyTicketValidator">
    		<property name="casValidate"><value>https&#58;//localhost&#58;8443/cas/proxyValidate</value></property>
    		<property name="proxyCallbackUrl"><value>https&#58;//localhost&#58;8443/contacts-cas/casProxy/receptor</value></property>
    		<property name="serviceProperties"><ref bean="serviceProperties"/></property>
    		<!-- <property name="trustStore"><value>/some/path/to/your/lib/security/cacerts</value></property> -->
    	</bean>
    	
    	<!-- CacheManager bean definition -->
    	<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
    		<property name="configLocation"><value>classpath&#58;/ehcache-failsafe.xml</value></property>
    	</bean>
    	
    	<bean id="ticketCacheBackend" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
    		<property name="cacheManager"><ref local="cacheManager"/></property>
    		<property name="cacheName"><value>ticketCache</value></property>
    	</bean>
    	
    	<bean id="statelessTicketCache" class="net.sf.acegisecurity.providers.cas.cache.EhCacheBasedTicketCache">
    		<property name="cache"><ref local="ticketCacheBackend"/></property>
    	</bean>
    	
    	<bean id="casAuthoritiesPopulator" class="net.sf.acegisecurity.providers.cas.populator.DaoCasAuthoritiesPopulator">
    		<property name="authenticationDao"><ref bean="jdbcDaoImpl"/></property>
    	</bean>
    	
    	<bean id="casProxyDecider" class="net.sf.acegisecurity.providers.cas.proxy.RejectProxyTickets"/>
    	
    	<!-- Md5PasswordEncoder bean definition -->
    	<bean id="passwordEncoder" class="net.sf.acegisecurity.providers.encoding.Md5PasswordEncoder"/>
    	
    </beans>
    web.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
    
    <!--
    	Esta Configuración esta basada en lo provisto por Jens Vag de Deutschland
    -->
    <beans>
    	<!-- ServiceProperties bean definition -->
    	<bean id="serviceProperties" class="net.sf.acegisecurity.ui.cas.ServiceProperties">
    		<property name="service"><value>https&#58;//localhost&#58;8443/JupenCalcu</value></property>
    		<property name="sendRenew"><value>false</value></property>
    	</bean>
    	
    	<!-- Cas Porcessing Filter definition -->
    	<bean id="casProcessingFilter" class="net.sf.acegisecurity.ui.cas.CasProcessingFilter">
    		<property name="authenticationManager"><ref bean="authenticationManager"/></property>
    		<property name="authenticationFailureUrl"><value>/</value></property>
    		<property name="defaultTargetUrl"><value>/</value></property>
    		<property name="filterProcessesUrl"><value>/login</value></property> 
    	</bean>
    	
    	<!-- Security Enforcement Filter bean Definition -->
    	<bean id="securityEnforcementFilter" class="net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter">
    		<property name="filterSecurityInterceptor"><ref bean="filterInvocationInterceptor"/></property>
    		<property name="authenticationEntryPoint"><ref local="casProcessingFilterEntryPoint"/></property>
    	</bean>
    	
    	<!-- Cas Processing Filter Entry Point bean definition -->
    	<bean id="casProcessingFilterEntryPoint" class="net.sf.acegisecurity.ui.cas.CasProcessingFilterEntryPoint">
    		<property name="loginUrl"><value>https&#58;//localhost&#58;8443/cas/login</value></property>
    		<property name="serviceProperties"><ref local="serviceProperties"/></property>
    		
    	</bean>
    	
    	<!-- AuthenticationManager bean definition -->
    	<bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
    		<property name="providers">
    			<list>
    				<ref bean="casAuthenticationProvider"/>
    			</list>
    		</property>
    	</bean>
    	
    	<!-- CasAuthenticationProvider bean definition -->
    	<bean id="casAuthenticationProvider" class="net.sf.acegisecurity.providers.cas.CasAuthenticationProvider">
    		<property name="casAuthoritiesPopulator"><ref local="casAuthoritiesPopulator"/></property>
    		<property name="casProxyDecider"><ref bean="casProxyDecider"/></property>
    		<property name="ticketValidator"><ref bean="casProxyTicketValidator"/></property>
    		<property name="statelessTicketCache"><ref bean="statelessTicketCache"/></property>
    		<property name="key"><value>acegi</value></property>
    	</bean>
    	
    	<!-- CasProxyTicketValidator bean definition -->
    	<bean id="casProxyTicketValidator" class="net.sf.acegisecurity.providers.cas.ticketvalidator.CasProxyTicketValidator">
    		<property name="casValidate"><value>https&#58;//localhost&#58;8443/cas/proxyValidate</value></property>
    		<property name="proxyCallbackUrl"><value>https&#58;//localhost&#58;8443/contacts-cas/casProxy/receptor</value></property>
    		<property name="serviceProperties"><ref bean="serviceProperties"/></property>
    		<!-- <property name="trustStore"><value>/some/path/to/your/lib/security/cacerts</value></property> -->
    	</bean>
    	
    	<!-- CacheManager bean definition -->
    	<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
    		<property name="configLocation"><value>classpath&#58;/ehcache-failsafe.xml</value></property>
    	</bean>
    	
    	<bean id="ticketCacheBackend" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
    		<property name="cacheManager"><ref local="cacheManager"/></property>
    		<property name="cacheName"><value>ticketCache</value></property>
    	</bean>
    	
    	<bean id="statelessTicketCache" class="net.sf.acegisecurity.providers.cas.cache.EhCacheBasedTicketCache">
    		<property name="cache"><ref local="ticketCacheBackend"/></property>
    	</bean>
    	
    	<bean id="casAuthoritiesPopulator" class="net.sf.acegisecurity.providers.cas.populator.DaoCasAuthoritiesPopulator">
    		<property name="authenticationDao"><ref bean="jdbcDaoImpl"/></property>
    	</bean>
    	
    	<bean id="casProxyDecider" class="net.sf.acegisecurity.providers.cas.proxy.RejectProxyTickets"/>
    	
    	<!-- Md5PasswordEncoder bean definition -->
    	<bean id="passwordEncoder" class="net.sf.acegisecurity.providers.encoding.Md5PasswordEncoder"/>
    	
    </beans>

    Comment


    • #3
      Further Information

      As you might have notice, Im using or at least I think im using CAS, correct me if im wrong but when I make reference to jdbcDaoImpl like this:
      Code:
      	<bean id="casAuthoritiesPopulator" class="net.sf.acegisecurity.providers.cas.populator.DaoCasAuthoritiesPopulator">
      		<property name="authenticationDao"><ref bean="jdbcDaoImpl"/></property>
      	</bean>
      Im calling the bean with id jdbcDaoImpl and as I dont have it defined here but in the CAS war applicationContext.xml file im loading that bean right? (the one from CAS).

      Comment


      • #4
        Odd.

        org.springframework.aop.framework.adapter.UnknownA dviceTypeException: Advice object [net.sf.acegisecurity.intercept.method.aopalliance. MethodSecurityInterceptor@528780] is neither a supported
        This is incorrect. MethodSecurityInterceptor can be used in the interceptor list for a ProxyFactoryBean.

        Do you have another spring*.jar or acegi-security*.jar on the classpath that is causing issues?

        I can see no immediate problem with your CAS config, but starting the application context successfully and trying it out is the first step.

        Comment


        • #5
          Hello Ben,

          This are the jars Im using:

          On Tomcat (Catalina)
          ${env.CATALINA_HOME}/common/lib
          1.- acegi-security-0.8.2.jar
          2.- aopalliance-1.0.jar
          3.- spring-1.2.3.jar

          ${env.CATALINA_HOME}/server/lib
          1.- acegi-security-cas-0.8.2.jar
          2.- acegi-security-catalina-0.8.2.jar
          3.- acegi-security-catalina-common-0.6.1.jar
          4.- acegi-security-catalina-server-0.6.1.jar

          On my App
          ${MyApp}/WEB-INF/lib
          1.- aopalliance-1.0.jar
          2.- spring-1.2.3.jar

          This is incorrect. MethodSecurityInterceptor can be used in the interceptor list for a ProxyFactoryBean.
          Im not sure I'd setup a ProxyFactoryBean, can you see that from the posts above or do I have to send any further info?

          Are the jar files correct? I mean their versions?

          Comment


          • #6
            I think you're using ProxyFactoryBean:

            <bean id="jbpmSB" class="org.springframework.aop.framework.ProxyFact oryBean">
            No Acegi Security nor Spring JARs should not be in any Catalina directory. You should only have the JARs inside your WAR. I think this is the root cause of your problem, so try removing them.

            Comment

            Working...
            X