wjw465150 / run-jetty-run

Automatically exported from code.google.com/p/run-jetty-run
0 stars 0 forks source link

Jetty 8 with Servlet 3.0 and Spring 3 WebApplicationInitializer does not process WebInfIncludeJarPattern in jetty-web.xml to skip complete JAR scanning #174

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What is the expected output? What do you see instead?
I'm using Servlet 3.0 without any web.xml just using Spring 
WebApplicationInitializer. When I start the Webapplication, the JARScanning 
takes about 40 seconds since it tries to find HandlesTypes annotations in all 
jars. 

Thus, I tried to set the WebInfIncludeJarPattern in the jetty-web.xml (I also 
tried jetty-context.xml) and put it in the webapp/WEB-INF folder. I also set 
metadata-complete="true". The content of the jetty-web.xml file is:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
    <Call name="setAttribute">
      <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
      <Arg>.*/.*foo-api-[^/]\.jar$|./.*bar-[^/]\.jar$|./.*wibble[^/]*\.jar$</Arg>
    </Call>
</Configure>

However, the JarScanner still scans all the JAR files. In the debug output I 
can see, that the jetty-web.xml file is parsed AFTER all the JARScanning is 
done:

OUTPUT:

2013-08-30 09:09:52.836:DBUG:oejw.WebAppContext:preConfigure 
o.e.j.w.WebAppContext{/admin2,[file:/C:/....../src/main/webapp/]} with 
runjettyrun.webapp.RJRWebInfConfiguration@1cdc4a5
......
2013-08-30 09:09:52.979:DBUG:oejw.WebAppContext:preConfigure 
o.e.j.w.WebAppContext{/admin2,[file:/C:/..../src/main/webapp/]} with 
org.eclipse.jetty.webapp.WebXmlConfiguration@136f39e
2013-08-30 
09:09:53.076:DBUG:oejw.WebDescriptor:file:/C:/......../src/main/webapp/WEB-INF/w
eb.xml: Calculated metadatacomplete = True with version=3.0
2013-08-30 09:09:53.076:DBUG:oejw.WebAppContext:preConfigure 
o.e.j.w.WebAppContext{/admin2,[file:/C:/....../src/main/webapp/]} with 
runjettyrun.webapp.RJRMetaInfoConfiguration@164de63
... <LOTS OF JARSCANNING>
2013-08-30 09:10:36.677:DBUG:oejw.JarScanner:Search of 
file:/C:/......./httpclient-cache-4.1.2.jar
2013-08-30 09:10:36.710:DBUG:oejw.WebAppContext:configure 
o.e.j.w.WebAppContext{/.................} with 
org.eclipse.jetty.webapp.JettyWebXmlConfiguration@803365
2013-08-30 09:10:36.711:DBUG:oejw.JettyWebXmlConfiguration:Configuring 
web-jetty.xml
2013-08-30 09:10:36.715:DBUG:oejw.JettyWebXmlConfiguration:Configure: 
file:/C:/......./src/main/webapp/WEB-INF/jetty-web.xml

How can I force RJR to pick up the jetty-web.xml earlier and only scan the 
files specified in there? Or is there any other way in RJR to specify the JARS 
to be scanned?

What Eclipse version are you using ?
Version: Kepler Release 4.3
Build id: 20130614-0229

What Run-Jetty-Run version are you using?
RJR  1.3.3.201301020723 
Jetty: 8.1.8.v20121106

What OS are you using ? 32bit or 64 bit?
WINDOWS 64 bit

Thank you

Original issue reported on code.google.com by dieter.m...@gmail.com on 30 Aug 2013 at 7:25

GoogleCodeExporter commented 9 years ago
WebAppContext jar scanning is done as part of the WebAppContext configurations.

By the time WEB-INF/jetty-web.xml is executed, that set of configurations is 
already fixed in stone and cannot be reconfigured.

Note: looking for WEB-INF/jetty-web.xml and using it *is* a WebAppContext 
configuration itself.  The last one [1].  This is intentional, and is standards 
/ spec breaking if you make the JettyWebXmlConfiguration anything but the last 
configuration.

The WebAppContext.setAttribute() for 
"org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern" is only supported as 
part of a Jetty IoC XML context deployable.

https://github.com/eclipse/jetty.project/blob/jetty-8.1.8.v20121106/jetty-annota
tions/src/main/config/etc/jetty-annotations.xml

Original comment by joakim.erdfelt on 9 Dec 2013 at 6:19