Hi,
I am trying to get Load Time Weaving using Spring for my grails project.
Details of my environment are as follows.
grails version : 2.4.2
Server : 1. Embedded Tomcat for local development
2. WebSphere 8.0.4 for higher environments.
I have attached the SampleAspect.groovy that I am using to weave specific aspect.
From what I understand to enable LoadTimeWeaving for Spring this is all we need to do :
<context:spring-configured />
<context:load-time-weaver aspectj-weaving="autodetect"/>
So I have place this in my applicationContext.xml in my grails project.
I set this argument while running run-app
-javaagent:path/to/spring-instrument.jar
If i just do this much as mentioned above I get this.
Caused by IllegalStateException: ClassLoader [org.grails.plugins.tomcat.ParentDelegatingClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent: -javaagent:org.springframework.instrument.jar
So From this :
http://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/html/aop.html#aop-aj-ltw-environment-generic
I need to put this in 'server.xml' of my tomcat :
<Context path="/myWebApp" docBase="/my/webApp/location">
<Loader
loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/>
</Context>
Problem :
In grails I cannot have access to my server.xml (According to Graeme Rocher : http://grails.1312388.n4.nabble.com/Where-do-I-look-for-server-xml-with-embedded-Tomcat-td1461189.html)
So given this how do I put the above configuration ?
Any help would be appreciated !!
Thanks.