You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "uwe schaefer (JIRA)" <ji...@apache.org> on 2007/11/15 18:54:43 UTC
[jira] Commented: (WICKET-1162) Use non-default namingPolicy when
creating Proxies via CGLib
[ https://issues.apache.org/jira/browse/WICKET-1162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12542829 ]
uwe schaefer commented on WICKET-1162:
--------------------------------------
i can confirm the above workaround.
adding:
e.setNamingPolicy(new DefaultNamingPolicy()
{
public String getClassName(final String prefix, final String source, final Object key,
final Predicate names)
{
return super.getClassName("WICKET_"+prefix, source, key, names);
}
});
did the trick as expected, so that Guicy-Interceptors can be used together with wicket-guice.
> Use non-default namingPolicy when creating Proxies via CGLib
> ------------------------------------------------------------
>
> Key: WICKET-1162
> URL: https://issues.apache.org/jira/browse/WICKET-1162
> Project: Wicket
> Issue Type: Improvement
> Components: wicket-guice
> Affects Versions: 1.3.0-rc1
> Environment: Guice 1.0,
> Reporter: uwe schaefer
>
> 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[] {Serializable.class, ILazyInitProxy.class,
> IWriteReplace.class});
> e.setSuperclass(type);
> e.setCallback(handler);
> e.setNamingPolicy(SOME_WICKET_SPECIFIC_NAMING_POLICY); // <- single new line
> return e.create();
> [...]
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.