You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by SS jong <ss...@hotmail.com> on 2020/02/26 01:35:02 UTC
javax.servlet.ServletContainerInitializer defined in jar not loading
on Tomcat 7.0.100
We have an webapp that has been running fine on Tomcat 7.0.99, but failed to load properly on Tomcat 7.0.100, upon investigation, it looks like
javax.servlet.ServletContainerInitializer that we defined in jar is not being loaded, and to make sure, we created a blank new webapp with a blank implementation of ServletContainerInitializer
public class TestSCI implements ServletContainerInitializer{
@Override
public void onStartup(Set<Class<?>> arg0, ServletContext arg1) throws ServletException {
System.out.println("********************************");
}
}
And add this class and also the “META-INF/services/javax.servlet.ServletContainerInitializer” entry in a jar and place this jar in WEB-INF/lib folder, with this simple setup, test shows that the ServletContainerInitializer is being loaded on Tomcat 7.0.99, but is not being loaded on Tomcat 7.0.100, is this change intentional on Tomcat 7.0.100 or is this a bug?
Looking at org.apache.catalina.startup.WebappServiceLoader from source code of Tomcat 7.0.100, it seems that the leading slash added on line 111 may have caused the issue, but I am not entirely sure.
On Tomat 7.0.100, ServletContainerInitializer will load if it is placed as plain text file entry in WEB-INF/classes, but the same ServletContainerInitializer will NOT load when the “META-INF/services/javax.servlet.ServletContainerInitializer” entry is placed in a jar file, Tomcat 7.0.99 will load the ServletContainerInitializer regardless where the “META-INF/services/javax.servlet.ServletContainerInitializer” entry is placed.
Has anyone encountered this issue on Tomcat 7.0.100 and if this behavior change is intentional?
Thanks.
Re: javax.servlet.ServletContainerInitializer defined in jar not
loading on Tomcat 7.0.100
Posted by SS jong <ss...@hotmail.com>.
Hi Rémy and Mark,
Just want to say thank you for looking into this and it is much appreciated.
Regards
Jong
________________________________
From: Rémy Maucherat <re...@apache.org>
Sent: Wednesday, February 26, 2020 20:17
To: Tomcat Users List <us...@tomcat.apache.org>
Subject: Re: javax.servlet.ServletContainerInitializer defined in jar not loading on Tomcat 7.0.100
On Wed, Feb 26, 2020 at 12:36 PM Rémy Maucherat <re...@apache.org> wrote:
> On Wed, Feb 26, 2020 at 9:57 AM Mark Thomas <ma...@apache.org> wrote:
>
>> On 26/02/2020 01:35, SS jong wrote:
>>
>> <snip/>
>>
>> > Has anyone encountered this issue on Tomcat 7.0.100 and if this
>> behavior change is intentional?
>>
>> Possibly the same root cause as
>>
>> https://bz.apache.org/bugzilla/show_bug.cgi?id=64153
>>
>
> I can confirm the issue, it is limited to 7.0 as 8.5 is fine.
>
> Indeed removing the leading "/" in the findResources call works around the
> problem.
>
The fix for the issue will be in 7.0.101.
Rémy
Re: javax.servlet.ServletContainerInitializer defined in jar not
loading on Tomcat 7.0.100
Posted by Rémy Maucherat <re...@apache.org>.
On Wed, Feb 26, 2020 at 12:36 PM Rémy Maucherat <re...@apache.org> wrote:
> On Wed, Feb 26, 2020 at 9:57 AM Mark Thomas <ma...@apache.org> wrote:
>
>> On 26/02/2020 01:35, SS jong wrote:
>>
>> <snip/>
>>
>> > Has anyone encountered this issue on Tomcat 7.0.100 and if this
>> behavior change is intentional?
>>
>> Possibly the same root cause as
>>
>> https://bz.apache.org/bugzilla/show_bug.cgi?id=64153
>>
>
> I can confirm the issue, it is limited to 7.0 as 8.5 is fine.
>
> Indeed removing the leading "/" in the findResources call works around the
> problem.
>
The fix for the issue will be in 7.0.101.
Rémy
Re: javax.servlet.ServletContainerInitializer defined in jar not
loading on Tomcat 7.0.100
Posted by Rémy Maucherat <re...@apache.org>.
On Wed, Feb 26, 2020 at 9:57 AM Mark Thomas <ma...@apache.org> wrote:
> On 26/02/2020 01:35, SS jong wrote:
>
> <snip/>
>
> > Has anyone encountered this issue on Tomcat 7.0.100 and if this behavior
> change is intentional?
>
> Possibly the same root cause as
>
> https://bz.apache.org/bugzilla/show_bug.cgi?id=64153
>
I can confirm the issue, it is limited to 7.0 as 8.5 is fine.
Indeed removing the leading "/" in the findResources call works around the
problem.
Rémy
Re: javax.servlet.ServletContainerInitializer defined in jar not
loading on Tomcat 7.0.100
Posted by Mark Thomas <ma...@apache.org>.
On 26/02/2020 01:35, SS jong wrote:
<snip/>
> Has anyone encountered this issue on Tomcat 7.0.100 and if this behavior change is intentional?
Possibly the same root cause as
https://bz.apache.org/bugzilla/show_bug.cgi?id=64153
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org