Embedded Tomcat does not honor ServletContainerInitializers
See original GitHub issueCurrently, the embedded Tomcat container does not detect and execute ServletContainerInitializers
. This means that dependencies that use them are never called and therefore are unable to contribute to the running application.
The embedded Tomcat container should be enhanced such that it properly notices the ServletContainerInitializers
on the Application’s classpath and executes them.
Issue Analytics
- State:
- Created 10 years ago
- Comments:22 (15 by maintainers)
Top Results From Across the Web
unit testing - Embedded Tomcat 7 does not found ...
Hi, afaik javax.servlet.ServletContainerInitializer is located at tomcat-embed-core. · Issue is now solved. I change the parent ClassLoader of ...
Read more >Apache Tomcat 8 (8.5.84) - Changelog
If upgrade is not possible, application code should cast to the internal Tomcat implementation classes. (markt); Fix: Switch Tomcat embedded ...
Read more >Changelog - Apache Tomcat 9 (9.0.17)
Do not add CSRF nonce parameter and suppress Referer header for external links ... Update the Tomcat embedded API by allowing to set...
Read more >Jetty : The Definitive Reference - Eclipse
While Jetty itself does not ship all of the Web Profile ... ServletContainerInitializer as shown in the embedded-jetty-jsp example on GitHub ...
Read more >Fix list for IBM WebSphere Application Server V8.5
disabledAlgorithms property is not honored in a certain Java thin client scenario ... PI37687, IBM Embedded WebSphere Application Server is missing the jar ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@philwebb could you be a bit more explicit what lead you to this design decision? What’s problematic about the search algorithm? Where in the boot source code do you disable that feature? Why wouldn’t you want the
ServletContainerInitializer
to be executed when you runjava -jar
? Would you consider supportingServletContainerInitializer
if some of the issues with it could be resolved?Also it’s not magical to execute all
ServletContainerInitializer
s.java.util.ServiceLoader.load(javax.servlet.ServletContainerInitializer)
should do the trick as all implementations of that interface have to be listed in/META-INF/services/javax.servlet.ServletContainerInitializer
.Servlet 3.0 made a really good job at defining this interface and the
@Web*
annotations as it makes it possible to write modular extensions to web applications (like stagemonitor) that just have to be on the classpath to be active and that are completely technology agnostic. It’s really a pity that boot beaks the spec multiple times (neitherServletContainerInitializer
nor@Web*
annotations are supported) which makes these mechanisms useless because they don’t work with boot, which is a (btw great) technology that just can’t be ignored.The goal of these servlet 3.0 mechanisms is to enable integration of standardized components without the user having to explicitly configure something. It’s sad that boot makes that impossible 😦
The spring-boot-samples tests are passing. Deploying the spring-boot-sample-web-jsp war to tomcat did also work. But the tests in
org.springframework.boot.autoconfigure.security.oauth2.SpringSecurityOAuth2AutoConfigurationTests
are failing with the following exception:The Javadoc of
SpringBootServletInitializer
states:So we probably have to find a way how to not invoke
SpringBootServletInitializer
in case of a java -jar deployment. Do you have an idea how to do that?