Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.3.0-rc1
-
None
-
Guice 1.0,
Description
As soon, as i use bindInterceptor(...) to an Instance, i run into a problem injecting this (CGLib enhanced) instance to a Component.
The exception thrown:
java.lang.LinkageError: loader (instance of org/mortbay/jetty/webapp/WebAppClassLoader): attempted duplicate class definition for name: "org/codesmell/jpadao/AbstractEntityDao$$FastClassByCGLIB$$aaf4cf30"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.inject.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
at com.google.inject.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
at com.google.inject.cglib.reflect.FastClass$Generator.create(FastClass.java:64)
at com.google.inject.cglib.proxy.MethodProxy.helper(MethodProxy.java:92)
at com.google.inject.cglib.proxy.MethodProxy.init(MethodProxy.java:56)
at com.google.inject.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:186)
at com.google.inject.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:66)
I assume the problem should disappear, if LazyInitProxyFactory.createProxy(...) was patched like:
[...]
CGLibInterceptor handler = new CGLibInterceptor(type, locator);
Enhancer e = new Enhancer();
e.setInterfaces(new Class[]
);
e.setSuperclass(type);
e.setCallback(handler);
e.setNamingPolicy(SOME_WICKET_SPECIFIC_NAMING_POLICY); // <- single new line
return e.create();
[...]