Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1162

Use non-default namingPolicy when creating Proxies via CGLib

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.0-rc1
    • Fix Version/s: 1.3.0-rc2
    • Component/s: wicket-guice
    • Labels:
      None
    • Environment:
      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[]

      {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();
      [...]

        Attachments

          Activity

            People

            • Assignee:
              jdonnerstag Juegen Donnerstag
              Reporter:
              javadoc uwe schaefer
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: