Tapestry
  1. Tapestry
  2. TAPESTRY-1301

Class not found with cglib loaded in a parent (non-webapp) classloader. (CglibProxiedPropertyChangeObserverImpl)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.1.2
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Tomcat 5.5.20

      Description

      We need CGLIB to reside in Tomcat's common/lib Classloader due to Hibernate-Issues.
      In this case, there is a ClassNotFoundException from CglibProxiedPropertyChangeObserverImpl.observePropertyChanges().

      This is, because net.sf.cglib.proxy.Enhancer's static create-method falls back on the classloader, in which it is loaded. The correct behaviour, imo, would be to make the enhancer use the thread-context-classloader.

      Proposed patch (tested, works well):
      In o.a.t.record.CglibPropertyChangeInterceptor change the lines (90ff):
      _________________
      Object ret = Enhancer.create(property.getClass(), interfaces,
      new ObservableMethodFilter(),
      new Callback[]

      { new LazyProxyDelegate(property), new CglibPropertyChangeInterceptor(component, property, propertyName)}

      );
      _______________

      into:
      ______________________
      Enhancer e = new Enhancer();
      e.setClassLoader( Thread.currentThread().getContextClassLoader() );
      e.setSuperclass(property.getClass());
      e.setInterfaces(interfaces);
      e.setCallbackFilter(new ObservableMethodFilter());
      e.setCallbacks(new Callback[]

      { new LazyProxyDelegate(property), new CglibPropertyChangeInterceptor(component, property, propertyName)}

      );
      Object ret = e.create();
      ________________________

        Activity

        Marcus Schulte created issue -
        Hide
        Jesse Kuhnert added a comment -

        I took the cglib enhancement stuff out for now, so I guess that has fixed the problem. Not sure if this style of property watching will come back or not yet.

        Show
        Jesse Kuhnert added a comment - I took the cglib enhancement stuff out for now, so I guess that has fixed the problem. Not sure if this style of property watching will come back or not yet.
        Jesse Kuhnert made changes -
        Field Original Value New Value
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 4.1.2 [ 12312202 ]
        Assignee Jesse Kuhnert [ jkuhnert ]
        Mark Thomas made changes -
        Workflow jira [ 12398253 ] Default workflow, editable Closed status [ 12569226 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12569226 ] jira [ 12590481 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        5d 6h 44m 1 Jesse Kuhnert 03/Mar/07 23:08

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Marcus Schulte
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development