package org.nutz.aop;


public class DefaultClassDefiner extends ClassLoader implements ClassDefiner {
	
	public DefaultClassDefiner(ClassLoader parent) {
		super(parent);
	}

	public Class<?> define(String className, byte[] bytes) throws ClassFormatError {
		try {
			return load(className);
		}
		catch (ClassNotFoundException e) {}
		// If not found ...
		return defineClass(className, bytes, 0, bytes.length);
	}

	public boolean has(String className) {
		try {
			load(className);
			return true;
		}
		catch (ClassNotFoundException e) {}
		return false;
	}

	public Class<?> load(String className) throws ClassNotFoundException {
		try{
			return Thread.currentThread().getContextClassLoader().loadClass(className);
		}
		catch (ClassNotFoundException e) {
			try{
				return ClassLoader.getSystemClassLoader().loadClass(className);
			}catch (ClassNotFoundException e2) {
				try{
					return getParent().loadClass(className);
				}catch (ClassNotFoundException e3) {
				}
			}
		}
		return super.loadClass(className);
	}
}

package org.nutz.aop;



public class DefaultClassDefiner extends ClassLoader implements ClassDefiner {
	
	public DefaultClassDefiner(ClassLoader parent) {
		super(parent);
	}

	public Class<?> define(String className, byte[] bytes) throws ClassFormatError {
		try {
			return load(className);
		}
		catch (ClassNotFoundException e) {}
		// If not found ...
		return defineClass(className, bytes, 0, bytes.length);
	}

	public boolean has(String className) {
		try {
			load(className);
			return true;
		}
		catch (ClassNotFoundException e) {}
		return false;
	}

	public Class<?> load(String className) throws ClassNotFoundException {
		try{
			return Thread.currentThread().getContextClassLoader().loadClass(className);
		}
		catch (ClassNotFoundException e) {
			try{
				return ClassLoader.getSystemClassLoader().loadClass(className);
			}
			catch (ClassNotFoundException e2) {
				try{
					return getParent().loadClass(className);
				}catch (ClassNotFoundException e3) {
				}
			}
			catch (SecurityException e2) {//Fix for GAE 1.3.7, Fix issue 
				try{
					return getParent().loadClass(className);
				}catch (ClassNotFoundException e3) {
				}
			}
		}
		return super.loadClass(className);
	}
}

Fix Issue 296 : 在gae上使用nutz ioc报错， nutz版本1.a.31及以后版本都报