Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] LTW of an applet

Hi,
I'm trying to LTW an applet - using a wrapper applet.
I have the jar - including the source applet, a jar including the aspects
and an applet that initialize the WeavingURLClassLoader and load the
source-applet.
in the html applet tag - I set the aspectjrt & aspectjweaver jars as
archive.
all jars are signed.
The problem is that the source is not weaving and works like there are no
aspects to run.
I get the source applet visible and no error at all!!!!

the aop.xml file is in the wrapper jar - is that correct? - what am I doing
wrong?
pls help - I'm desperate.

here is the code of the wrapper applet:

import java.awt.Component;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.jar.JarFile;

import javax.swing.JApplet;

import org.aspectj.weaver.loadtime.WeavingURLClassLoader;

public class SmApplet extends JApplet {
	public void init() {
		
		try {
			
			File source = new
File("C:/workspace/HackClassLoader/target/AOP-1.0.jar");
			File aspect = new
File("C:/workspace/HackClassLoader/target/demoAOP-1.0.jar");
			URL[] urlList = {source.toURL(), aspect.toURL()};
			URL[] aspectUrlList = {};
			
			WeavingURLClassLoader weavingClassLoader = new
WeavingURLClassLoader(urlList, aspectUrlList,
Thread.currentThread().getContextClassLoader());
			
			Class mainApplet =
weavingClassLoader.loadClass("demoAOP.HelloMainApplet");
			Object applet = mainApplet.newInstance();
			
			if (mainApplet != null) {

				Class[] args = null;
				Method init = mainApplet.getMethod("init", args);
				init.invoke(applet, (Object[])null);
				this.add((Component)applet);
			}
			
		} catch (MalformedURLException me){
			System.out.println("MalformedURLException");
			me.printStackTrace();
		} catch (ClassNotFoundException cx){
			System.out.println("ClassNotFoundException");
			cx.printStackTrace();
		} catch (NoSuchMethodException nx){
			System.out.println("NoSuchMethodException");
			nx.printStackTrace();
		} catch (InvocationTargetException ix){
			System.out.println("InvocationTargetException");
			ix.printStackTrace();
		} catch (IllegalAccessException ax){
			System.out.println("IllegalAccessException");
			ax.printStackTrace();
		} catch (InstantiationException ee) {
			System.out.println("InstantiationException");
			ee.printStackTrace();
		}
		
	}

}

-- 
View this message in context: http://www.nabble.com/LTW-of-an-applet-tp20109437p20109437.html
Sent from the AspectJ - users mailing list archive at Nabble.com.



Back to the top