Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] @missing@ exception while using LTW.


Michael,

This looks like a bug. Did you use the @AspectJ syntax to define your aspect(s)? Did you use javac or ajc to compile them? Are you able to post one of the aspects that causes the failure?

Thanks

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx

http://w3.hursley.ibm.com/~websterm/

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:        aspectj-users-bounces@xxxxxxxxxxx

To:        <aspectj-users@xxxxxxxxxxx>
cc:        
Subject:        RE: [aspectj-users] @missing@ exception while using LTW.


To be continued ... :)
 
I have compiled my java code and my aspects separately. While compiling aspects, I received several warnings like:
 
[warning] this affected type is not exposed to the weaver
and
[warning] advice defined in ... has not been applied
 
but I've ignored them because in load-time all types will be available and all advices should be applied by LTWeaver, right?
 
Then I run my program, and got this exception exact number of times as number of aspects declared in aop.xml:
 
java.lang.NullPointerException
at org.aspectj.weaver.tools.WeavingAdaptor$WeavingClassFileProvider.getBytes(WeavingAdaptor.java:390)
at org.aspectj.weaver.tools.WeavingAdaptor.getAtAspectJAspectBytes(WeavingAdaptor.java:259)
at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:181)
at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:66)
at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:52)
at sun.instrument.TransformerManager.transform(TransformerManager.java:122)
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:155)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1629)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:850)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1299)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
...

 
Any Ideas?
 
Thanks a lot!
 
-----Original Message-----
From:
aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Michael Kantarovich
Sent:
Monday, November 07, 2005 8:07 PM
To:
aspectj-users@xxxxxxxxxxx
Subject:
RE: [aspectj-users] @missing@ exception while using LTW.

Thanks!
 
I've just figured this out by myself ... :)
 
-----Original Message-----
From:
aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Ron Bodkin
Sent:
Monday, November 07, 2005 7:05 PM
To:
aspectj-users@xxxxxxxxxxx
Subject:
RE: [aspectj-users] @missing@ exception while using LTW.

Hi Michael,
 
Did you compile the aspect or just put the source in that directory? With load-time weaving, you still need to compile your aspects into bytecode, but you don’t need to “weave” with the classes at build-time. Try compiling your aspect and putting the result in the same directory, e.g.,
 
cd WEB-INF\classes
ajc com\test\MyAspect.aj
 
(of course for production use, I’d recommend compiling with an ant task and deploying this class file with the rest of your application…) 10x
 




From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Michael Kantarovich
Sent:
Monday, November 07, 2005 8:36 AM
To:
aspectj-users@xxxxxxxxxxx
Subject:
[aspectj-users] @missing@ exception while using LTW.

 

Hi everybody!

I'm using aspectj M4 version and trying to enable load-time weaving for my application. The application is web application.

I have created aop.xml under WEB-INF/classes/META-INF.

Here is the file:

<aspectj>

        <aspects>

                <aspect name="com.test.MyAspect"/>

        </aspects>

        <weaver options="-XlazyTjp -showWeaveInfo">

                <include within="com.test.*"/>

        </weaver>

</aspectj>

I'm using weaving agent through the JVMTI.

The trouble is that weaver is unable to find MyAspect, although it's present in directory WEB-INF/classes/com/test.

If I understand correct, I just have to place .aj file in the classpath of my application, and to declare it in aop.xml … So what can be wrong?

Here is the stack trace:

warning Register definition failed -- (RuntimeException) Cannot register non aspect: @missing@ , com.test.MyAspect

Cannot register non aspect: @missing@ , com.test.MyAspect

java.lang.RuntimeException: Cannot register non aspect: @missing@ , com.test.MyAspect

        at org.aspectj.weaver.bcel.BcelWeaver.addLibraryAspect(BcelWeaver.java:174)

        at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.registerAspects(ClassLoaderWeavingAdaptor.java:278)

        at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.registerDefinitions(ClassLoaderWeavingAdaptor.java:166)

        at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.initialize(ClassLoaderWeavingAdaptor.java:114)

        at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.initialize(Aj.java:129)

        at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.getWeavingAdaptor(Aj.java:134)

        at org.aspectj.weaver.loadtime.Aj$WeaverContainer.getWeaver(Aj.java:100)

        at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:65)

        at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:52)

        at sun.instrument.TransformerManager.transform(TransformerManager.java:122)

        at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:155)

        at sun.misc.Unsafe.defineClass(Native Method)

        at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)

        at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)

        at java.security.AccessController.doPrivileged(Native Method)

        at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)

        at sun.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:76)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:30)

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)

        at java.lang.Class.newInstance0(Class.java:350)

        at java.lang.Class.newInstance(Class.java:303)

            ….
 

Thanks a lot!

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


Back to the top