jsr369-experts@servlet-spec.java.net

[jsr369-experts] Re: [126-onStartupWebXmlVersionLevel] Discussion

From: Mark Thomas <markt_at_apache.org>
Date: Sat, 21 Feb 2015 13:51:26 +0000

On 21/02/2015 00:06, Edward Burns wrote:
> Hello Volunteers,
>
> I'm observing some inconsistent behavior between GlassFish and WLS on
> this point and I wonder what you all are doing in your respective
> containers. Here's the scoop. Apologies if I'm missing something
> fundamental here.
>
> I have a web module with a ServletContainerInitializer impl within it.
> I observe that the onStartup() method gets called just fine in GlassFish
> 4.1 regardless of if the web.xml has 2.5 or 3.0, but on WLS, it has to
> be 3.0 for it to be called.
>
> Do we need something in the spec that requires onStartup() to be called
> if present regardless of the version level?

There was a similar discussion previously regarding annotation scanning
that resulted in the text at 1.6.1 being added.

From the point of view of consistency I'd say GlassFish is doing what
the spec intended and WLS is not.

Tomcat, like GlassFish, always scans for SCIs regardless of version.

For the record, I'd like to repeat my previously stated view that I
think this behaviour is wrong. It means that an app that behaves one way
on a Servlet 2.5 container may behave completely differently on a
Servlet 3.0 container because a bundled library uses annotations and/or
SCIs. Given J2EE's strong views on backwards compatibility this is not
what a user is going to expect.

So, while it looks like WLS is breaking the spec, I much prefer that
solution: Servlet X pluggability features should only be enabled with a
Servlet X or later web.xml. Unfortunately, I think the time has long
since passed to change this without creating a whole bunch of different
backward compatibility issues.

Mark