Dear all,

I've been trying to use AspectJ to weave an aspect into an existing OSGi
bundle (I'm trying to weave directly in to the JAR, as that's actually the
point of what I'm doing) but I'm getting strange results.

So far I've been able to do the actual weaving but when I load the bundle
onto Apache Felix, I get the following:
-------------------8<---------------------
g! felix:start 20
g! Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
org/aspectj/lang/NoAspectBoundException
        at
org.apache.felix.example.servicebased.host.DrawingFrame.<init>(DrawingFrame.java:54)
        at
org.apache.felix.example.servicebased.host.Activator$1.run(Activator.java:69)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown
Source)
--------------------8<--------------------

The bundle I've been using for my experiments is the one provided by the
Felix project itself at [1]. I'm trying to weave the following aspect into
the 'host' bundle:
--------------------8<--------------------
import java.awt.*;
import java.awt.event.*;
import java.util.*;

import javax.swing.*;

import org.apache.felix.example.servicebased.host.DrawingFrame;

public aspect ComponentLogger {
pointcut frameConstruction(DrawingFrame d) : this(d) &&
execution(DrawingFrame.new());

   before(DrawingFrame d) : frameConstruction(d)
   {
      JOptionPane.showMessageDialog(d,"We've just weaved into the
constructor!");
   }
}
--------------------8<------------------

The goal of this would be to have a message dialog show up whenever a
DrawingFrame is created. Am I doing something blatantly wrong? Or is it
simply not possible to weave aspects into OSGi bundles?

Many Thanks,
Tiago

[1] -
http://felix.apache.org/site/apache-felix-application-demonstration.html
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to