Results 1 to 4 of 4

Thread: newbie question concerning aspectjweaver.jar

  1. #1
    Join Date
    Dec 2009
    Location
    Berlin
    Posts
    3

    Default newbie question concerning aspectjweaver.jar

    Hello Community,

    Iīm new to Spring-AOP and have a question concerning aspectjweaver.jar.

    first the story:

    I tried to do some performance-logging with the JamonPerformanceMonitorInterceptor which is included in spring.jar (2.5.6).

    In my aspects-configuration.xml iīve defined something like:

    Code:
    	<aop:config>
    		<aop:pointcut id="jamonMonitoringPointcut"
    			expression="execution(* x.y.MyClass.refresh(..))" />
    
    		<aop:advisor pointcut-ref="jamonMonitoringPointcut"
    			advice-ref="jamonMonitoringAspectInterceptor" />
    	</aop:config>
    
    	<!-- Performance Monitoring Bean-->
    	<bean class="org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor"
    		id="jamonMonitoringAspectInterceptor">
    
    		<property name="loggerName" value="Profiler" />
    	</bean>
    Everything works fine (every refresh methode is correct logged) when iīve include the aspectjweaver.jar in my classpath.
    If iīve not included aspectjweaver.jar in my classpath, i get an exception while starting my application:

    Code:
    ...
    Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException
    1. I thought i only need to include aspectjweaver.jar in my classpath, if i want to enable @AspectJ support (spring documentation 6.2.2).
    What does is mean 'to enable @AspectJ support'? I havenīt used some aspectj-style annotations.

    2. Is it possible to uses the JamonPerformanceMonitorInterceptor with using some XML based pointcut expressions like defined above without to include this aspectjweaver.jar?

    thanks

  2. #2
    Join Date
    Jun 2006
    Location
    SF Bay Area, California
    Posts
    524

    Default

    Spring uses classes in aspectjweaver.jar to parse pointcut expressions and making matching decisions. In your case, you will need to have aspectjweaver.jar in the classpath.

    -Ramnivas
    Ramnivas Laddad (Follow me on Twitter)
    AspectJ in Action: Enterprise AOP with Spring Applications (2nd edition). Now available!

  3. #3
    Join Date
    Dec 2009
    Location
    Berlin
    Posts
    3

    Default

    thank you ramnivas,

    you said in my case i need to have aspectjweaver.jar in the classpath,
    but if this jar is needed to parse pointcut expressions and making matching decisions,
    then itīs needed in nearly every case, when you want to use aspects (except for example creating proxys with org.springframework.aop.framework.ProxyFactoryBean and some interceptors).

    If this jar is needed in nearly every case - why isnīt it a spring module and included in the spring.jar?

    The aspectjweaver.jar is about 1.5 MByte big -> 5 times bigger than the spring-core module itself.
    I want to use only spring-aop with proxy style - no aspectj - is there a possibility to use a smaller jar?

  4. #4
    Join Date
    Jun 2006
    Location
    SF Bay Area, California
    Posts
    524

    Default

    It isn't a spring module jar because it is from a different project (AspectJ). If the jar file size is a concern (on most projects, it isn't), you may try using aspectjrt.jar and org.aspectj.matcher.jar from AspectJ distribution.

    -Ramnivas
    Ramnivas Laddad (Follow me on Twitter)
    AspectJ in Action: Enterprise AOP with Spring Applications (2nd edition). Now available!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •