Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ weaves classes not included in aop.xml and throws NullPointerException

Not sure if this is still an issue for you, sorry I am late responding.

> AspectJ reports that it can't find configuration for MyClassLoader

It will find the configuration if a meta-inf/aop.xml file is visible via a getResourceAsStream against your MyClassLoader. I'm not sure what classpath you have given that loader.

java.lang.NullPointerException

I'd upgrade to 1.7.3 - some changes around handling of weaving adaptors have gone in that may affect things here.

Why AspectJ tries to weave this classes? 

When you say it tries to weave the classes, do you mean that you actually see it trying (what message do you see?) or you are wondering why AspectJ is active at all?  If you are using the agent option when starting the jvm, aspectj will attempt to attach a weaver to all classloaders. If no configuration is found (which you mention is happening) then the weaver won't be turned on and it won't be trying to weave the classes.

cheers,
Andy



On 29 May 2013 04:55, Sergius <sergius000@xxxxxxxxx> wrote:
AspectJ 1.7.1, LTW.

We use custom classloader that loads classes from byte[] array.

Class loading looks like this:
Class clazz = new MyClassLoader().defineClass(classPackage + className, bytecode, 0, bytecode.length);

This code executes concurrently.

Classes from classPackage are not included for weaving in aop.xml. Moreover, AspectJ reports that it can't find configuration for MyClassLoader.

From time to time we are getting the following exceptions:

SEVERE: my.package.MyClass
java.lang.NullPointerException
        at org.aspectj.weaver.Dump.dumpOnExit(Dump.java:163)
        at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:100)
        at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:54)
        at sun.instrument.TransformerManager.transform(TransformerManager.java:169)
        at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:365)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:466)
        at MyClassLoader.defineClass
        ...
       
Why AspectJ tries to weave this classes?

Why it fails with NullPointerException?

Sergii

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top