On Nov 23, 2005, at 12:34 PM, [EMAIL PROTECTED] wrote:
Author: dain
Date: Wed Nov 23 12:33:58 2005
New Revision: 348552
URL: http://svn.apache.org/viewcvs?rev=348552&view=rev
Log:
GERONIMO-1064 change proxy generation to always use an explicit class
loader
Added:
geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/
proxy/ProxyCreationException.java (with props)
Modified:
geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/
basic/BasicProxyManager.java
geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/
basic/BasicProxyMap.java
geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/
proxy/ProxyManager.java
geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/
GBeanTest.java
+ /**
+ * Creates a proxy factory for GBeans of the specified type. The
proxy class will be created within the class
+ * loader from which the specified type was loaded, or from the
system class loader if the specified type has
+ * a null class loader.
+ *
+ * @param type the type of the proxies this factory should create
+ * @return the proxy factory
+ */
+ public ProxyFactory createProxyFactory(Class type) {
+ if (type == null) throw new NullPointerException("type is
null");
+
+ ClassLoader classLoader = type.getClassLoader();
+ if(classLoader == null) {
+ classLoader = ClassLoader.getSystemClassLoader();
+ }
+
+ return createProxyFactory(new Class[] {type}, classLoader);
+ }
+
I don't think the system classloader can ever be correct, at least it
seems to break the configs-based build. The enhancer needs to be able
to load cglib classes from the classloader you use, and it can't from
the system classloader (or whatever was being returned from
ClassLoader.getSystemClassLoader()). If I change this to
classLoader = this.getClass().getClassLoader();
my build works. Do you see any problem with this?
thanks
david jencks