Just committed a change with a simple override to the Tomcat StandardJarScanner. Seems to work ok in tests here, please let me know if you have any problems.
Cheers Jon On Fri, Apr 1, 2011 at 11:29 PM, David Blevins <[email protected]>wrote: > Could be a good short term solution. I'm all for the "quick fix to buy > time" strategy. > > The xbean-finder suggestion would be great long-term if we could work that > out. We could then get consistent include/exclude support for embedded and > tomcat. As we ideally won't have to scan twice like we do now. > > On a related scanning note, I hope we can get Meta-Annotation support > worked in for Servlets too. That will probably require deeper changes > though. Might not be possible very easily. Anyway, it would require > xbean-finder so if that's there already, could be good. > > > -David > > On Apr 1, 2011, at 3:15 PM, Jonathan Gallimore wrote: > > > Looks like we can specify some jars to exclude on StandardJarScanner - > I'm > > going to experiment with that and see if that works. Should hopefully get > it > > done tomorrow morning. > > > > Jon > > > > On Fri, Apr 1, 2011 at 10:21 PM, Jonathan Gallimore < > > [email protected]> wrote: > > > >> Sorry about that! It looks like not scanning the classloader classes is > not > >> quite right. Seems like we've identified why we're loading so many > classes > >> though. I was thinking that maybe we could swap the JarScanner in the > >> StandardContext for one that either filters out our jar files, or uses > >> xbean-finder. What do you think? > >> > >> Jon > >> > >> > >> On Fri, Apr 1, 2011 at 9:00 PM, David Blevins <[email protected] > >wrote: > >> > >>> We're definitely heading in the right direction. We might need to > tweak > >>> our JSF support a bit. See tck@ > >>> > >>> Side note, check out the BackportUtil class. Probably can merge that > >>> TomcatHelper right in. > >>> > >>> > >>> -David > >>> > >>> On Mar 31, 2011, at 4:19 PM, [email protected] wrote: > >>> > >>>> Author: jgallimore > >>>> Date: Thu Mar 31 23:19:14 2011 > >>>> New Revision: 1087503 > >>>> > >>>> URL: http://svn.apache.org/viewvc?rev=1087503&view=rev > >>>> Log: > >>>> stop tomcat scanning the whole classpath looking for web.xml fragments > >>>> > >>>> Modified: > >>>> > >>> > openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-catalina/src/main/java/org/apache/openejb/tomcat/catalina/GlobalListenerSupport.java > >>>> > >>> > openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-loader/src/main/java/org/apache/openejb/tomcat/loader/TomcatHelper.java > >>>> > >>>> Modified: > >>> > openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-catalina/src/main/java/org/apache/openejb/tomcat/catalina/GlobalListenerSupport.java > >>>> URL: > >>> > http://svn.apache.org/viewvc/openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-catalina/src/main/java/org/apache/openejb/tomcat/catalina/GlobalListenerSupport.java?rev=1087503&r1=1087502&r2=1087503&view=diff > >>>> > >>> > ============================================================================== > >>>> --- > >>> > openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-catalina/src/main/java/org/apache/openejb/tomcat/catalina/GlobalListenerSupport.java > >>> (original) > >>>> +++ > >>> > openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-catalina/src/main/java/org/apache/openejb/tomcat/catalina/GlobalListenerSupport.java > >>> Thu Mar 31 23:19:14 2011 > >>>> @@ -28,6 +28,7 @@ import org.apache.catalina.core.Standard > >>>> import org.apache.catalina.core.StandardHost; > >>>> import org.apache.catalina.core.StandardServer; > >>>> import org.apache.openejb.tomcat.loader.TomcatHelper; > >>>> +import org.apache.tomcat.JarScanner; > >>>> > >>>> import java.beans.PropertyChangeEvent; > >>>> import java.beans.PropertyChangeListener; > >>>> @@ -113,6 +114,10 @@ public class GlobalListenerSupport imple > >>>> contextListener.afterStop(standardContext); > >>>> } else if (DESTROY_EVENT.equals(type) || > >>> Lifecycle.AFTER_DESTROY_EVENT.equals(type)) { > >>>> contextListener.destroy(standardContext); > >>>> + } else if (Lifecycle.CONFIGURE_START_EVENT.equals(type)) > { > >>>> + if (TomcatHelper.isTomcat7()) { > >>>> + > TomcatHelper.configureJarScanner(standardContext); > >>>> + } > >>>> } > >>>> } else if (source instanceof StandardHost) { > >>>> StandardHost standardHost = (StandardHost) source; > >>>> > >>>> Modified: > >>> > openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-loader/src/main/java/org/apache/openejb/tomcat/loader/TomcatHelper.java > >>>> URL: > >>> > http://svn.apache.org/viewvc/openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-loader/src/main/java/org/apache/openejb/tomcat/loader/TomcatHelper.java?rev=1087503&r1=1087502&r2=1087503&view=diff > >>>> > >>> > ============================================================================== > >>>> --- > >>> > openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-loader/src/main/java/org/apache/openejb/tomcat/loader/TomcatHelper.java > >>> (original) > >>>> +++ > >>> > openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-loader/src/main/java/org/apache/openejb/tomcat/loader/TomcatHelper.java > >>> Thu Mar 31 23:19:14 2011 > >>>> @@ -130,4 +130,14 @@ public class TomcatHelper { > >>>> public static boolean isTomcat7() { > >>>> return > >>> System.getProperty("tomcat.version").startsWith("7."); > >>>> } > >>>> + > >>>> + public static void configureJarScanner(StandardContext > >>> standardContext) { > >>>> + try { > >>>> + Object jarScanner = > >>> > StandardContext.class.getMethod("getJarScanner").invoke(standardContext); > >>>> + > >>> jarScanner.getClass().getMethod("setScanClassPath", > >>> Boolean.TYPE).invoke(jarScanner, false); > >>>> + } catch (Exception e) { > >>>> + // ignore > >>>> + e.printStackTrace(); > >>>> + } > >>>> + } > >>>> } > >>>> > >>>> > >>>> > >>> > >>> > >> > >
