Announcement Announcement Module
Collapse
No announcement yet.
Newbie question: cannot convert to required type [org.aopalliance.aop.Advice] Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Newbie question: cannot convert to required type [org.aopalliance.aop.Advice]

    I am new to Spring but am trying to integrate it for logging on an existing web application that is running on JBoss 4.2.1 GA. The error is:

    PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.rmc.common.advice.LoggingAdvice] to required type [org.aopalliance.aop.Advice] for property 'advice'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [com.rmc.common.advice.LoggingAdvice] to required type [org.aopalliance.aop.Advice] for property 'advice': no matching editors or conversion strategy found

    Code:
            <bean
                    class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" />
                    
            <bean id="loggingAdvice" class="com.rmc.common.advice.LoggingAdvice" autowire="no" />
    
    
     
            <bean id="loggingAdvisor" 
                    class="org.springframework.aop.aspectj.AspectJExpressionPointcutAdvisor">
                    <property name="advice" ref="loggingAdvice" />
                    <property name="expression"     value="execution(* *AppService.*(..))" />
            </bean>
            
            <bean id="logger" class="com.rmc.common.log.Logger"/>
    Snippet from the advice class:

    Code:
    public class LoggingAdvice implements MethodInterceptor{
    
    	private Logger log;
    	
    	public LoggingAdvice() {};
    	/*
    	 * (non-Javadoc)
    	 * 
    	 * @see org.aopalliance.intercept.MethodInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
    	 */
    	/* (non-Javadoc)
    	 * @see com.rmc.common.advice.ILoggingAdvice#invoke(org.aopalliance.intercept.MethodInvocation)
    	 */
    	public Object invoke(MethodInvocation invocation) throws Throwable {
    
    		try {
    
                          //do something
                    } catch (Exception e) {
    
    			LoggerImpl.logError(invocation.getClass(),
    					"Exception Thrown in method: " + invocation.getMethod(), e);
    
    			throw e;
    		}
    	}
    }
    I have searched all over for this error but cannot find anyone else with the problem. I have a feeling that this is an ultra newbie issue.

    Ideas?

  • #2
    Search your classpath. You probably have a classloading issue. I guess you either have multiple spring jars in different classloaders or some aopalliance jar hanging around in a different classloader.

    Comment

    Working...
    X