I am trying to add support for spring AspectJ load time weaving by porting TomcatInstrumentableClassLoader (a subclass of WebappClassLoader) to TomEE. If there is a way to add these to the classloader another way I am open to looking at that option.
Specifically I am adding these methods to the classloader which are expected by convention to be present on the classloader so they can be invoked by refection. public void addTransformer(java.lang.instrument.ClassFileTransformer) public ClassLoader getThrowawayClassLoader() http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/instrument/classloading/ReflectiveLoadTimeWeaver.html http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/instrument/classloading/tomcat/TomcatInstrumentableClassLoader.html Trevor Stevens [email protected] On Jul 25, 2013, at 11:18 AM, Romain Manni-Bucau <[email protected]> wrote: > without a custom loader tomee will set its lazystopclassloader. > > you can extend the LazyStopLoader to activate it. > > PS: which kind of hook do you need? we already have a bunch of way to > enrich the classloader in tomee for instance > > *Romain Manni-Bucau* > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* > *Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/> > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* > *Github: https://github.com/rmannibucau* > > > > 2013/7/25 Trevor Stevens <[email protected]> > >> No, I did not. I was hoping to rely on TomEE's already configured loader >> to keep the same functionality. I am only trying to add instrumentation >> hooks in my custom classloader so I really don't want to change TomEE to >> deviate far from the standard configuration. >> >> >> Trevor Stevens >> [email protected] >> >> >> On Jul 25, 2013, at 11:07 AM, Romain Manni-Bucau <[email protected]> >> wrote: >> >>> Hi >>> >>> did you set a custom Loader (and not classloader)? >>> >>> *Romain Manni-Bucau* >>> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* >>> *Blog: **http://rmannibucau.wordpress.com/*< >> http://rmannibucau.wordpress.com/> >>> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* >>> *Github: https://github.com/rmannibucau* >>> >>> >>> >>> 2013/7/25 Trevor Stevens <[email protected]> >>> >>>> I am attempting to specify a custom classloader for TomEE but I am >> having >>>> limited success. I am attempting to follow the advice in TOMEE-970 and >> I >>>> am extending LazyStopWebappClassLoader and relying on the existing >> loader. >>>> When running I notice my classloader is created but it is never actually >>>> set as the classloader for the application. >>>> >>>> Looking quickly at the code I see two areas which might be related to my >>>> issue. >>>> org.apache.openejb.config.QuickContextXmlParser @ 75 I believe this is >>>> where my classloader is being created and never used again. >>>> org.apache.tomee.catalina.TomcatWebAppBuilder @ 965 initContextLoader >>>> always sets loaderClass to LazyStopWebappClassLoader >>>> >>>> Related >>>> https://issues.apache.org/jira/browse/TOMEE-970 >>>> >>>> >> http://openejb.979440.n4.nabble.com/Context-Loader-element-ignored-TOMEE-1-5-2-td4663593.html#none >>>> >>>> Trevor Stevens >>>> [email protected] >>>> >>>> >>>> >> >>
