tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryn Cooke <brynco...@gmail.com>
Subject WebappClassLoaderBase.addTransformer and servlet 3.0
Date Fri, 04 Sep 2015 07:22:08 GMT
Hi,
I've recently been looking at using the class transformer functionality 
in Tomcat 8.0.26 and came across a subtle interaction with servlet 3.0. 
I am registering my transformer in a ServletContainerInitializer via 
InstrumentableClassLoader.addTransformer, but couldn't understand why 
some classes appeared to not undergo transformation. It turned out they 
were annotated and were being passed in to another 
ServletContextInitializer by virtue of it using @HandlesTypes. This 
meant that the class had already been loaded before I had a chance to 
register the transformer.

I can't think of a nice way around this, but was wondering if there 
there was any appetite for creating a mechanism to register transformers 
directly after WebAppClassLoader is set up, perhaps via the 
ServiceLoader mechanism?
Or perhaps there is another way of registering the transformer earlier?

Ideally I would like to avoid the javaagent route as it will interfere 
with other wep apps that are deployed on the same tomcat instance and 
make deployment less easy.

Many thanks,

Bryn



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


Mime
View raw message