You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/06/14 15:43:56 UTC

svn commit: r1493066 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Author: markt
Date: Fri Jun 14 13:43:56 2013
New Revision: 1493066

URL: http://svn.apache.org/r1493066
Log:
Container provided JARs should not be scanned for deployment annotations nor should they be checked for web-fragment.xml files.

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1493066&r1=1493065&r2=1493066&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Jun 14 13:43:56 2013
@@ -1149,9 +1149,10 @@ public class ContextConfig implements Li
 
         // Ordering is important here
 
-        // Step 1. Identify all the JARs packaged with the application
-        // If the JARs have a web-fragment.xml it will be parsed at this
-        // point.
+        // Step 1. Identify all the JARs packaged with the application and those
+        // provided by the container. If any of the application JARs have a
+        // web-fragment.xml it will be parsed at this point. web-fragment.xml
+        // files are ignored for container provided JARs.
         Map<String,WebXml> fragments = processJarsForWebFragments();
 
         // Step 2. Order the fragments.
@@ -2734,8 +2735,12 @@ public class ContextConfig implements Li
             fragment.setWebappJar(isWebapp);
 
             try {
-                jar = JarFactory.newInstance(url);
-                is = jar.getInputStream(FRAGMENT_LOCATION);
+                // Only web application JARs are scanned for deployment
+                // annotations and web-fragment.xml files
+                if (isWebapp) {
+                    jar = JarFactory.newInstance(url);
+                    is = jar.getInputStream(FRAGMENT_LOCATION);
+                }
 
                 if (is == null) {
                     // If there is no web.xml, normal JAR no impact on



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


Re: svn commit: r1493066 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Posted by Rainer Jung <ra...@kippdata.de>.
On 14.06.2013 18:36, Christopher Schultz wrote:
> Mark,
> 
> On 6/14/13 12:22 PM, Mark Thomas wrote:
>> On 14/06/2013 17:15, Christopher Schultz wrote:
>>> I was actually hoping that certain JDBC drivers would start packaging a
>>> listener that could do things like stop driver-launched threads, etc.
>>> that the user doesn't really know have been started. Will this then
>>> always be a requirement of the webapp to provide a listener that
>>> essentially does nothing on startup but then terminates things on
>>> shutdown?
>>
>> They'd have to include an SCI (which is always processed) and that SCI
>> can register a ServletContextListener.
> 
> Sorry... I'm not yet sensitive to the different language being used
> here. I read the original commit comment as "don't scan container JARs
> at all" instead of what you said which was to "not scan for
> annotations". Big difference ;)

Yup, later commit by mark http://svn.apache.org/r1493080 clarified SCI
use for container Jars.

Rainer


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


Re: svn commit: r1493066 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Mark,

On 6/14/13 12:22 PM, Mark Thomas wrote:
> On 14/06/2013 17:15, Christopher Schultz wrote:
>> I was actually hoping that certain JDBC drivers would start packaging a
>> listener that could do things like stop driver-launched threads, etc.
>> that the user doesn't really know have been started. Will this then
>> always be a requirement of the webapp to provide a listener that
>> essentially does nothing on startup but then terminates things on
>> shutdown?
> 
> They'd have to include an SCI (which is always processed) and that SCI
> can register a ServletContextListener.

Sorry... I'm not yet sensitive to the different language being used
here. I read the original commit comment as "don't scan container JARs
at all" instead of what you said which was to "not scan for
annotations". Big difference ;)

-chris


Re: svn commit: r1493066 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Posted by Mark Thomas <ma...@apache.org>.
On 14/06/2013 17:15, Christopher Schultz wrote:
> I was actually hoping that certain JDBC drivers would start packaging a
> listener that could do things like stop driver-launched threads, etc.
> that the user doesn't really know have been started. Will this then
> always be a requirement of the webapp to provide a listener that
> essentially does nothing on startup but then terminates things on shutdown?

They'd have to include an SCI (which is always processed) and that SCI 
can register a ServletContextListener.

Mark


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


Re: svn commit: r1493066 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Mark,

On 6/14/13 11:54 AM, Mark Thomas wrote:
> On 14/06/2013 16:38, Rainer Jung wrote:
>> On 14.06.2013 15:43, markt@apache.org wrote:
>>> Author: markt
>>> Date: Fri Jun 14 13:43:56 2013
>>> New Revision: 1493066
>>>
>>> URL: http://svn.apache.org/r1493066
>>> Log:
>>> Container provided JARs should not be scanned for deployment
>>> annotations nor should they be checked for web-fragment.xml files.
>>
>> Sorry I haven't really investigated this, but:
>>
>> - I think I have seen you committing a change that labels common loader
>> loaded Jars as container provided
> 
> Correct.
> 
>> - we usually suggest to pack JDBC drivers into the common loader, right?
> 
> Correct.
> 
>> So as a general consistency check to the above: we don't expect JDBC
>> drivers to contain relevant annotations, web fragments etc. in the near
>> future?
> 
> I certainly don't.

I was actually hoping that certain JDBC drivers would start packaging a
listener that could do things like stop driver-launched threads, etc.
that the user doesn't really know have been started. Will this then
always be a requirement of the webapp to provide a listener that
essentially does nothing on startup but then terminates things on shutdown?

Or is the idea that these issues are moot unless the driver is actually
in WEB-INF/lib and in that case the listeners will actually be
discovered and fire?

-chris


Re: svn commit: r1493066 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Posted by Mark Thomas <ma...@apache.org>.
On 14/06/2013 16:38, Rainer Jung wrote:
> On 14.06.2013 15:43, markt@apache.org wrote:
>> Author: markt
>> Date: Fri Jun 14 13:43:56 2013
>> New Revision: 1493066
>>
>> URL: http://svn.apache.org/r1493066
>> Log:
>> Container provided JARs should not be scanned for deployment annotations nor should they be checked for web-fragment.xml files.
>
> Sorry I haven't really investigated this, but:
>
> - I think I have seen you committing a change that labels common loader
> loaded Jars as container provided

Correct.

> - we usually suggest to pack JDBC drivers into the common loader, right?

Correct.

> So as a general consistency check to the above: we don't expect JDBC
> drivers to contain relevant annotations, web fragments etc. in the near
> future?

I certainly don't.

Note that any framework JARs in the common loader will always have SCIs 
processed.

Mark


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


Re: svn commit: r1493066 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Posted by Rainer Jung <ra...@kippdata.de>.
On 14.06.2013 15:43, markt@apache.org wrote:
> Author: markt
> Date: Fri Jun 14 13:43:56 2013
> New Revision: 1493066
> 
> URL: http://svn.apache.org/r1493066
> Log:
> Container provided JARs should not be scanned for deployment annotations nor should they be checked for web-fragment.xml files.

Sorry I haven't really investigated this, but:

- I think I have seen you committing a change that labels common loader
loaded Jars as container provided

- we usually suggest to pack JDBC drivers into the common loader, right?

So as a general consistency check to the above: we don't expect JDBC
drivers to contain relevant annotations, web fragments etc. in the near
future?

Regards,

Rainer

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