cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure alfresco for Spring AOP

amitnerkar
Champ in-the-making
Champ in-the-making
Hi,

I have an Alfresco project already running. I needed to configure Spring AOP in Alfresco application. I have created a Spring-AOP-context.xml where all the aop configuration is done.
The Spring-AOP-context.xml is as follows:

<?xml version='1.0' encoding='UTF-8'?>

<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:aop="http://www.springframework.org/schema/aop"
      xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

   
   <!– Pointcuts –>
   <aop:config>
   <aop:pointcut id="tstPointcut"
      expression="execution(public void com.ccs.credential.web.bean.workflow.CCSProcessManageTaskDialog.init(..))" />
   <aop:advisor pointcut-ref="tstPointcut" advice-ref="testAdvice" />
   </aop:config>
   
   <!– AOP Proxy Interceptors –>
   <bean id="testAdvice" class="com.ccs.credential.metrics.CCSProcessManageTaskDialogBeforeAdvice"/>

</beans>


But whenever the application is deployed in tomcat it gives this error


INFO: Deploying web application archive alfresco.war
17:02:05,531 ERROR [web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'avmBootstrap
' defined in class path resource [alfresco/bootstrap-context.xml]: Error setting property values; ne
sted exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExcep
tions (1) are:
PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert proper
ty value of type [$Proxy43] to required type [org.alfresco.repo.avm.AVMLockingAwareService] for prop
erty 'avmLockingAwareService'; nested exception is java.lang.IllegalArgumentException: Cannot conver
t value of type [$Proxy43] to required type [org.alfresco.repo.avm.AVMLockingAwareService] for prope
rty 'avmLockingAwareService': no matching editors or conversion strategy found
Caused by:
org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) a
re:
PropertyAccessException 1:
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy43]
to required type [org.alfresco.repo.avm.AVMLockingAwareService] for property 'avmLockingAwareServic
e'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy43]
to required type [org.alfresco.repo.avm.AVMLockingAwareService] for property 'avmLockingAwareService
': no matching editors or conversion strategy found
Caused by:
java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy43] to required type [org.al
fresco.repo.avm.AVMLockingAwareService] for property 'avmLockingAwareService': no matching editors o
r conversion strategy found


What could be the solution? Please help.

Thanks & Regards,
Amit Nerkar
2 REPLIES 2

cosminaru
Champ in-the-making
Champ in-the-making
Hi,

I am struggling with exactly the same thing. Did you find a way around this?

Thanks,
Cosmin

cosminaru
Champ in-the-making
Champ in-the-making
I think I found the problem. Is actually a Spring issue:

http://static.springsource.org/spring/docs/2.0.x/reference/aop.html - scroll to 6.3. Schema-based AOP support:
========
Warning

The <aop:config> style of configuration makes heavy use of Spring's auto-proxying mechanism. This can cause issues (such as advice not being woven) if you are already using explicit auto-proxying via the use of BeanNameAutoProxyCreator or suchlike. The recommended usage pattern is to use either just the <aop:config> style, or just the AutoProxyCreator style.
========

And there is actually a BeanNameAutoProxyCreator in the Alfresco config (and probably other auto-proxying stuff) - so the <aop:config> is a no-no in this case.