[jboss-user] [JBoss AOP] - jboss-aop.xml is trying to apply an already existing method

elysch do-not-reply at jboss.com
Tue May 13 22:05:03 EDT 2008


Hi again.

I do understand the meaning of the error i'm getting now:

2008-05-13 19:16:52,781 ERROR [STDERR] [warn] AOP Instrumentor failed to transform com.mitalteli.bolsaDeTrabajo.vo.VacanteVO
  | 2008-05-13 19:16:52,781 ERROR [STDERR] java.lang.RuntimeException: Mixin com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.MixinAspectoVacanteVO of pointcut jar:file:/C:/jboss-4.2.1.GA/server/default/tmp/deploy/tmp4165bolsaDeTrabajo-1.0-SNAPSHOT.ear-contents/bolsaDeTrabajo-aop-1.0-SNAPSHOT.aop!/META-INF/jboss-aop.xml7 is trying to apply an already existing methodgetRequisitos for class com.mitalteli.bolsaDeTrabajo.vo.VacanteVO
  | ...

The problem is that I'm not doing it on purpose. I guess I don't know how to define introductions-mixins and aspects in the jboss-aop.xml file. I don't get it.

I did read the reference guide and the user manual, but I can't find out why it doesn't work. Maybe I'm skipping the exact paragraph that has the answer, I don't know.

I guess it is correct to define both a mixin to add attributes and method's that the class don't have and also an advice to modify the behavior of other already existing methods. Right?

The original class:
public class VacanteVO
  |     implements java.io.Serializable
  | {
  |     /**
  |      * The serial version UID of this class. Needed for serialization.
  |      */
  |     private static final long serialVersionUID = -1038158559825459105L;
  | 
  |     public VacanteVO()
  |     {
  |         this.id = null;
  |     }
  | 
  |     public VacanteVO(java.lang.Long id)
  |     {
  |         this.id = id;
  |     }
  | 
  |     /**
  |      * Copies constructor from other VacanteVO
  |      *
  |      * @param otherBean, cannot be <code>null</code>
  |      * @throws java.lang.NullPointerException if the argument is <code>null</code>
  |      */
  |     public VacanteVO(VacanteVO otherBean)
  |     {
  |         this(otherBean.getId());
  |     }
  | 
  |     /**
  |      * Copies all properties from the argument value object into this value object.
  |      */
  |     public void copy(VacanteVO otherBean)
  |     {
  |         if (otherBean != null)
  |         {
  |             this.setId(otherBean.getId());
  |         }
  |     }
  | 
  |     private java.lang.Long id;
  | 
  |     /**
  |      * 
  |      */
  |     public java.lang.Long getId()
  |     {
  |         return this.id;
  |     }
  | 
  |     public void setId(java.lang.Long id)
  |     {
  |         this.id = id;
  |     }
  | 
  | }


The mixin interface:
public interface IAspectoVacanteVO { 
  |     
  |     public java.lang.String getNombre();
  |     public void setNombre(java.lang.String nombre);
  | 
  |     public java.lang.String getRequisitos();
  |     public void setRequisitos(java.lang.String requisitos);
  | 
  |     public java.lang.String getDescripcion();
  |     public void setDescripcion(java.lang.String descripcion);
  | 
  |     public com.mitalteli.bolsaDeTrabajo.domain.VacanteHorario getHorario();
  |     public void setHorario(com.mitalteli.bolsaDeTrabajo.domain.VacanteHorario horario);
  | 
  |     public com.mitalteli.bolsaDeTrabajo.domain.RangoSueldo getSueldo();
  |     public void setSueldo(com.mitalteli.bolsaDeTrabajo.domain.RangoSueldo sueldo);
  | 
  |     public java.lang.String getContacto();
  |     public void setContacto(java.lang.String contacto);
  | 
  |     public com.mitalteli.bolsaDeTrabajo.domain.VacanteStatus getStatus();
  |     public void setStatus(com.mitalteli.bolsaDeTrabajo.domain.VacanteStatus status);
  | 
  |     public java.lang.Long getEmpresa();
  |     public void setEmpresa(java.lang.Long empresa);
  | }

I won't put here the implementation since it compiles, and I don't think makes any difference. (Am I right?)

A jboss-aop.xml fragment:
   <!-- **************************************************************************** -->
  |    <!-- INICIO: com.mitalteli.bolsaDeTrabajo.vo.VacanteVO -->
  | 
  |    <introduction class="com.mitalteli.bolsaDeTrabajo.vo.VacanteVO">
  |       <mixin>
  |          <interfaces>
  | 	       com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.IAspectoVacanteVO
  |          </interfaces>
  |          <class>com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.MixinAspectoVacanteVO</class>
  |          <construction>new com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.MixinAspectoVacanteVO(this)</construction>
  |       </mixin>
  |    </introduction>
  |    
  |    <aspect class="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteVO" scope="PER_VM"/>
  |    <bind pointcut="execution(com.mitalteli.bolsaDeTrabajo.vo.VacanteVO->new())">
  |        <advice name="constructorNoParamsAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteVO"/>
  |    </bind>
  |    <bind pointcut="execution(com.mitalteli.bolsaDeTrabajo.vo.VacanteVO->new(VacanteVO))">
  |        <advice name="constructorFromOtherAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteVO"/>
  |    </bind>
  |    <bind pointcut="execution(* com.mitalteli.bolsaDeTrabajo.vo.VacanteVO->copy(VacanteVO))">
  |        <advice name="methodCopyAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteVO"/>
  |    </bind>
  | 
  |    <!-- FIN: com.mitalteli.bolsaDeTrabajo.vo.VacanteVO -->

VacanteVO is not used anywhere else, but, here (further down in jboss-aop.xml):
   <aspect class="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteDaoBase" scope="PER_VM"/>
  |    <bind pointcut="execution(* com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase->toVacanteVO(com.mitalteli.bolsaDeTrabajo.domain.Vacante, com.mitalteli.bolsaDeTrabajo.vo.VacanteVO))">
  |        <advice name="methodToVacanteVOAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteDaoBase"/>
  |    </bind>
  |    <bind pointcut="execution(* com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase->vacanteVOToEntity(com.mitalteli.bolsaDeTrabajo.vo.VacanteVO, com.mitalteli.bolsaDeTrabajo.domain.Vacante, boolean))">
  |        <advice name="methodVacanteVOToEntityAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteDaoBase"/>
  |    </bind>

But in these cases it's only used as method parameter. That's the way they are defined in the original coding. It wouldn't be able to catch exactly that method if the pointcut binding is defined differently, right?

I'm getting the same error for another two classes in which I define a mixin and some advices. But there is one that it's not being reported as an error. I can't see any noticeable difference in the coding.

This is the one that is not being reported as an error:
   <!-- **************************************************************************** -->
  |    <!-- INICIO: com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase -->
  | 
  |    <introduction class="com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase">
  |       <mixin>
  |          <interfaces>
  | 	       com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.IAspectoVacanteDaoBase
  |          </interfaces>
  |          <class>com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.MixinAspectoVacanteDaoBase</class>
  |          <construction>new com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.MixinAspectoVacanteDaoBase(this)</construction>
  |       </mixin>
  |    </introduction>
  | 
  |    <aspect class="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteDaoBase" scope="PER_VM"/>
  |    <bind pointcut="execution(* com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase->toVacanteVO(com.mitalteli.bolsaDeTrabajo.domain.Vacante, com.mitalteli.bolsaDeTrabajo.vo.VacanteVO))">
  |        <advice name="methodToVacanteVOAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteDaoBase"/>
  |    </bind>
  |    <bind pointcut="execution(* com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase->vacanteVOToEntity(com.mitalteli.bolsaDeTrabajo.vo.VacanteVO, com.mitalteli.bolsaDeTrabajo.domain.Vacante, boolean))">
  |        <advice name="methodVacanteVOToEntityAdvice" aspect="com.mitalteli.bolsaDeTrabajo.useCaseSlices.specific.consultarVacantes.AspectoVacanteDaoBase"/>
  |    </bind>
  | 
  |    <!-- FIN: com.mitalteli.bolsaDeTrabajo.domain.VacanteDaoBase -->

I hope someone knows what is happening.

Thank you all in advance.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150573#4150573

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4150573



More information about the jboss-user mailing list