Well as I say, rather than !within(groovy), you will need to spell out all your groovy type names individually !within(com.lee.groovy.Thing) && !within(com.lee.groovy.OtherThing) etc... hopefully they are all in the same package and you can exclude that package. !within(com.lee.groovy..*) There isn't another way, at the moment the weaver doesn't treat groovy (or scala, or any JVM bytecode) as different just because a different compiler produced it.
Andy On 10 February 2011 16:52, Grey, Lee <[email protected]> wrote: > I bumped it up to Xmx512m, but that still got the OOM error. I went up to > Xmx768m, and now there is no error, just a 45-second delay for the first > invocation to complete. > > Can I skip this long delay by adding !within(groovy) to all my pointcuts, or > is there a better way? > > Thanks, > Lee > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Andy Clement > Sent: Thursday, February 10, 2011 7:25 PM > To: [email protected] > Subject: Re: [aspectj-users] OutOfMemoryError caused by ltw of Groovy? > > Hi, > > AspectJ can weave Groovy just fine - Spring Insight uses AspectJ to weave > into Grails apps in order to collect monitoring info. > > A few observations though: > > 1. groovy classes are *big*, bigger than their java counterparts. > When AspectJ has a problem it tries to be helpful and print out the class > containing the problem by converting the bytecode into its 'opcode' form - > like you would see if you used javap. Something has gone wrong and in trying > to tell you what has gone wrong, it has run out of space trying to print this > groovy class. Unfortunately the original error is lost now this out of > memory has occurred. > > 2. From your ajcore file I notice you have an Xmx of 256m, that isn't > particularly high. > > I'd recommend running with a larger Xmx, that should enable the true error to > come out as the groovy class will be printable. Based on that error we can > decide what to do next... There currently is a > !within(groovy) type pointcut, so you would just have to exclude them based > on their names, but perhaps lets see what the underlying error is before > doing anything else. > > cheers > Andy > > On 10 February 2011 15:56, Grey, Lee <[email protected]> wrote: >> I've been using AspectJ to advise a method call in Sonic ESB without >> any issues for about a week. >> >> Recently, though, I started building out the functionality, and I >> included the use of a Groovy class that is instantiated and called >> from within my aspect. About that same time, I started seeing a long >> pause followed by a stack trace each time I ran the first message >> through the Sonic container after a restart. >> >> I've now confirmed that this happens not upon instantiating the Groovy >> object but during the first call to any one of its methods. It >> doesn't matter which method gets called. That first method call will >> cause the error that I've attached. >> >> Is this AspectJ gagging on Groovy? What can I do to prevent? I don't >> need to use any aspects on the Groovy code, and I don't believe any of >> my pointcuts reference my Groovy code. I just need to make AspectJ >> leave Groovy alone, I guess. >> >> Thanks, >> Lee Grey >> >> Feb 10, 2011 6:50:31 PM org.aspectj.weaver.tools.Jdk14Trace error >> SEVERE: org/codehaus/groovy/runtime/ArrayUtil >> java.lang.OutOfMemoryError: Java heap space >> at java.io.ByteArrayOutputStream.write(Unknown Source) >> at java.io.PrintStream.write(Unknown Source) >> at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(Unknown Source) >> at sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(Unknown Source) >> at sun.nio.cs.StreamEncoder.flushBuffer(Unknown Source) >> at java.io.OutputStreamWriter.flushBuffer(Unknown Source) >> at java.io.PrintStream.newLine(Unknown Source) >> at java.io.PrintStream.println(Unknown Source) >> at >> org.aspectj.weaver.bcel.LazyMethodGen$BodyPrinter.print(LazyMethodGen. >> java:652) >> at >> org.aspectj.weaver.bcel.LazyMethodGen$BodyPrinter.run(LazyMethodGen.ja >> va:572) >> at >> org.aspectj.weaver.bcel.LazyMethodGen.print(LazyMethodGen.java:533) >> at >> org.aspectj.weaver.bcel.LazyClassGen.printOne(LazyClassGen.java:834) >> at org.aspectj.weaver.bcel.LazyClassGen.print(LazyClassGen.java:793) >> at >> org.aspectj.weaver.bcel.LazyClassGen.toLongString(LazyClassGen.java:78 >> 1) >> at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1703) >> at >> org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:16 >> 18) >> at >> org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1379 >> ) >> at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1173) >> at >> org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.j >> ava:467) >> at >> org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java >> :318) >> at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:96) >> at >> org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(Cl >> assPreProcessorAgentAdapter.java:54) >> at sun.instrument.TransformerManager.transform(Unknown Source) >> at sun.instrument.InstrumentationImpl.transform(Unknown Source) >> at java.lang.ClassLoader.defineClass1(Native Method) >> at java.lang.ClassLoader.defineClass(Unknown Source) >> at java.security.SecureClassLoader.defineClass(Unknown Source) >> at java.net.URLClassLoader.defineClass(Unknown Source) >> at java.net.URLClassLoader.access$100(Unknown Source) >> at java.net.URLClassLoader$1.run(Unknown Source) >> at java.security.AccessController.doPrivileged(Native Method) >> at java.net.URLClassLoader.findClass(Unknown Source) Feb 10, 2011 >> 6:50:31 PM org.aspectj.weaver.tools.Jdk14Trace info >> INFO: Dumping to >> C:\Sonic\Workbench7.5\eclipse\.\ajcore.20110210.185031.884.txt >> _______________________________________________ >> aspectj-users mailing list >> [email protected] >> https://dev.eclipse.org/mailman/listinfo/aspectj-users >> >> > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
