You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2016/04/04 12:18:43 UTC

[Bug 59270] New: Regression with Spring with AspectJ Load-Time Weaving

https://bz.apache.org/bugzilla/show_bug.cgi?id=59270

            Bug ID: 59270
           Summary: Regression with Spring with AspectJ Load-Time Weaving
           Product: Tomcat 8
           Version: 8.0.33
          Hardware: PC
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: andrei.ivanov@gmail.com

It looks like the custom class loader isn't getting used anymore in 8.0.33.

With spring-instrument-tomcat-4.2.5.RELEASE.jar in the Tomcat lib folder and 
<Context>
    <Loader
loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"
/>
</Context>

in the context.xml of the web application.

Deployed in 8.0.22, I see TomcatInstrumentableClassLoader getting invoked
immediately when the app starts deploying and no calls in 8.0.33.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59270] Regression with Spring with AspectJ Load-Time Weaving

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59270

Violeta Georgieva <vi...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED

--- Comment #5 from Violeta Georgieva <vi...@apache.org> ---
Hi,

I'm closing this issue with WON'T FIX.

Spring's TomcatLoadTimeWeaver should be used instead of
TomcatInstrumentableClassLoader.

Regards,
Violeta

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59270] Regression with Spring with AspectJ Load-Time Weaving

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59270

--- Comment #2 from Andrei Ivanov <an...@gmail.com> ---
Hi,
As I've shown in https://bz.apache.org/bugzilla/show_bug.cgi?id=58143, the
recommended Spring solution didn't work for me as Tomcat was already loading
the class I want to weave before Spring gets initialized.

Indeed, the custom classloader gets picked up.
Ha, seems that the API has changed again:
On 8.0.32, the new method was called: findResourceInternal(String name, String
path, boolean manifestRequired)
This created the issue for Spring earlier :)

On 8.0.33, it reverts back to calling the initial method:
findResourceInternal(String name, String path)

This is the Spring method body (in both cases):
protected ResourceEntry findResourceInternal(String name, String path) {
        ResourceEntry entry = super.findResourceInternal(name, path);
        if (entry != null && entry.binaryContent != null &&
path.endsWith(CLASS_SUFFIX)) {
            String className = (name.endsWith(CLASS_SUFFIX) ? name.substring(0,
name.length() - CLASS_SUFFIX.length()) : name);
            entry.binaryContent =
this.weavingTransformer.transformIfNecessary(className, entry.binaryContent);
        }
        return entry;
    }

The problem now is that entry.binaryContent is null, so the weaving doesn't
take place.

This might be the cause:
https://github.com/apache/tomcat/commit/bd3cd71dd8a40b02e1728d98a9c241ef630573ef#diff-3f0901a8e99cbddfc81363aeb77a0109

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59270] Regression with Spring with AspectJ Load-Time Weaving

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59270

Andrei Ivanov <an...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #4 from Andrei Ivanov <an...@gmail.com> ---
Hmm, it seems that I was forced to rely on the TomcatInstrumentableClassLoader
because of this cache (as described in 58143).

Now that the cache is gone, TomcatInstrumentableClassLoader no longer works but
the recommended way works now :-)

So, I think it still counts as a regression, but I guess you can mark it as a
won't fix.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59270] Regression with Spring with AspectJ Load-Time Weaving

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59270

Violeta Georgieva <vi...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
             Status|NEW                         |NEEDINFO

--- Comment #1 from Violeta Georgieva <vi...@apache.org> ---
Hi,

I do not observe this issue.

I'm testing with Tomcat 8.0.33 and examples application and I clearly see

org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader
TomcatInstrumentableClassLoader
  context: examples
  delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@34ce8af7


Regards,
Violeta

PP: I found the note below in the Spring Framework javadoc
http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/instrument/classloading/tomcat/TomcatInstrumentableClassLoader.html

NOTE: Requires Apache Tomcat version 6.0 or higher, as of Spring 4.0. This
class is not intended to work on Tomcat 8.0+; please rely on Tomcat's own
InstrumentableClassLoader facility instead, as autodetected by Spring's
TomcatLoadTimeWeaver.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59270] Regression with Spring with AspectJ Load-Time Weaving

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59270

--- Comment #3 from Remy Maucherat <re...@apache.org> ---
Well, keeping this around actually seemed to use a lot of memory (not an issue
with small webapps obviously), so it's probably not going to be restored.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org