Announcement Announcement Module
Collapse
No announcement yet.
load time weaver and tomcat 6 problem! Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • load time weaver and tomcat 6 problem!

    Dear Spring community

    what have i missed?

    I am trying to get load-time-weaver working in spring 3
    on tomcat 6 in eclipse Eclipse Java EE IDE for Web Developers.

    Build id: 20090920-1017

    i have followed the instructions given here

    7.8.4 Load-time weaving with AspectJ in the Spring Framework

    heres my aspect
    package com.pre.school.aop;

    import org.aspectj.lang.ProceedingJoinPoint;
    import org.aspectj.lang.annotation.Around;
    import org.aspectj.lang.annotation.Aspect;
    import org.aspectj.lang.annotation.Pointcut;

    @Aspect
    public class KevynAucoin extends BaseAspect {

    /**
    * A join point is in the Data Access Object layer if the method is defined
    * in a type in the com.pre.school.persistent.hibernate package or any
    * sub-package under that.
    */
    @Pointcut("within(com.pre.school.dao..*)")
    public void inDataAccessObjectLayer() {
    }

    /**
    * the execution of any method with a name beginning with "set"
    */
    @Pointcut("execution(* com.pre.school.dao.*.*(..))")
    public void setBeechey() {
    }

    @Around("inDataAccessObjectLayer()")
    public Object doSetting(ProceedingJoinPoint pjp) throws Throwable {
    Object retVal = pjp.proceed();
    return retVal;
    }

    }

    heres my aop.xml in META-INF
    <!DOCTYPE aspectj PUBLIC
    "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
    <aspectj>

    <weaver>

    <!-- only weave classes in our application-specific packages -->
    <include within="com.pre.school.dao.*" />

    </weaver>

    <aspects>

    <!-- weave in just this aspect -->
    <aspect name="com.pre.school.aop.KevynAucoin" />

    </aspects>

    </aspectj>

    this my spring config for aspect

    <?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:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...-beans-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd">


    <bean id="preSchoolPresentationAspects" class="com.pre.school.aop.KevynAucoin" />

    <!-- this switches on the load-time weaving -->
    <context:load-time-weaver />

    </beans>

    heres my tomcat 6 context.xml

    <Context path="/Aardvark">
    <Loader loaderClass="org.springframework.instrument.classl oading.tomcat.TomcatInstrumentableClassLoader"/>
    </Context>

    the thing is my tomcat 6 install doesnt appear to have a $CATALINA_HOME/server/lib folder! why is that?

    so i cant follow this instruction
    "Copy org.springframework.instrument.tomcat.jar into $CATALINA_HOME/server/lib, where $CATALINA_HOME represents the root of the Tomcat installation."

    so i put this jar "org.springframework.instrument.tomcat-3.0.0.RELEASE.jar"
    in the $CATALINA_HOME/lib folder

    one question i have is... how do you work out what your docbase is in this

    <Context path="/myWebApp" docBase="/my/webApp/location">
    <Loader
    loaderClass="org.springframework.instrument.classl oading.tomcat.TomcatInstrumentableClassLoader"/>
    </Context>

  • #2
    moving on

    I have now managed to get aspects working fine...

    As long as i always follow these steps

    1). Clean Tomcat server
    2). Start server
    3). Test ... everything ok

    if i now stop and start the tomcat server (without clean)
    the aspects do not get weaved!

    This is within eclipse (galileo)

    Why Why Why ? do i have to clean before every server start?

    Comment

    Working...
    X