Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] NPE at org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1415) - AspectJ 1.6.11

Hi,

There are a couple of old issues related to CGLIB:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=120372
https://bugs.eclipse.org/bugs/show_bug.cgi?id=117854

Basically, CGLIB bytecode is 'unusual' - valid but unusual.  However,
typically you don't want to weave into these things.  I haven't seen
the particular manifestation you are showing here though, I'd need a
simple sample to recreate if you want me to investigate further but
the reason CGLIB weaving hasn't been fully addressed is because
usually weaving it is accidental and undesirable - so the solution is
to exclude it.  I seem to recall the implementation effort to fix the
proxy weaving case was very costly and difficult to justify when the
answer is that it shouldn't be woven.

Having said that I've seen problems with the generated proxies in the
past, not with the FastClass objects, so this might be something new.
Are you sure you need to weave them?

Feel free to raise an issue for the NPE though - obviously it
shouldn't NPE - but the cheap fix for that might be a message
indicating you should exclude CGLIB stuff because it cannot be
reliably woven.

cheers,
Andy

On 7 May 2012 19:44, Choudary Kothapalli <choudary.kothapalli@xxxxxxxxx> wrote:
> My product MaintainJ uses AspectJ 1.6.11 to load time weave Java
> applications. When instrumenting Spring based applications, sometimes I get
> exceptions like the one below:
>
> May 7, 2012 10:51:22 PM org.aspectj.weaver.tools.Jdk14Trace error
> SEVERE: com/xxx/yyy/zzz/Abc$$FastClassByCGLIB$$161e674
> java.lang.NullPointerException
>     at org.aspectj.weaver.bcel.LazyMethodGen.remap(LazyMethodGen.java:1415)
>     at
> org.aspectj.weaver.bcel.LazyMethodGen.addExceptionHandlers(LazyMethodGen.java:1269)
>     at
> org.aspectj.weaver.bcel.LazyMethodGen.packBody(LazyMethodGen.java:1067)
>     at org.aspectj.weaver.bcel.LazyMethodGen.pack(LazyMethodGen.java:968)
>     at
> org.aspectj.weaver.bcel.LazyMethodGen.getMethod(LazyMethodGen.java:462)
>     at org.aspectj.weaver.bcel.LazyClassGen.writeBack(LazyClassGen.java:492)
>     at
> org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:674)
>     at
> org.aspectj.weaver.bcel.BcelWeaver.getClassFilesFor(BcelWeaver.java:1436)
>     at
> org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1398)
>     at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1180)
>     at
> org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java: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(ClassPreProcessorAgentAdapter.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.defineClassCond(Unknown Source)
>     at java.lang.ClassLoader.defineClass(Unknown Source)
>     at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>     at java.lang.reflect.Method.invoke(Unknown Source)
>     at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
>     at
> net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
>     at net.sf.cglib.reflect.FastClass$Generator.create(FastClass.java:64)
>     at net.sf.cglib.proxy.MethodProxy.helper(MethodProxy.java:81)
>     at net.sf.cglib.proxy.MethodProxy.create(MethodProxy.java:46)
>     at
> com.fl.sas3.render.engine.PreviewRenderer$$EnhancerByCGLIB$$a285e30b.CGLIB$STATICHOOK13(<generated>)
>     at
> com.fl.sas3.render.engine.PreviewRenderer$$EnhancerByCGLIB$$a285e30b.<clinit>(<generated>)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>     at java.lang.reflect.Method.invoke(Unknown Source)
>     at net.sf.cglib.proxy.Enhancer.setCallbacksHelper(Enhancer.java:616)
>     at net.sf.cglib.proxy.Enhancer.setThreadCallbacks(Enhancer.java:609)
>     at net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:631)
>     at net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:538)
>     at
> net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:225)
>     at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
>     at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
>     at
> org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:201)
>     at
> org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
> ...
>
> The errors are pretty consistent - all of them are at the same line
> LazyMethodGen.java:1415. Is this something that can be fixed? Is this
> related to this bug?
>
> I currently ask my users to exclude that class. Any fix for this will be of
> great help.
>
> Thanks,
> Choudary Kothapalli.
>
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>


Back to the top