Skip to content

Avoid overly specific casting in SslConnectorCustomizer #43849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mmoayyed opened this issue Jan 16, 2025 · 5 comments
Closed

Avoid overly specific casting in SslConnectorCustomizer #43849

mmoayyed opened this issue Jan 16, 2025 · 5 comments
Assignees
Labels
type: task A general task
Milestone

Comments

@mmoayyed
Copy link
Contributor

I am starting to experiment with Apache Tomcat 11 and Spring Boot 3.4.x. A first blocking issue I have run into is the following:

Caused by: java.lang.ClassNotFoundException: org.apache.coyote.http11.AbstractHttp11JsseProtocol
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[?:?]
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[?:?]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?]
        at org.springframework.boot.web.embedded.tomcat.SslConnectorCustomizer.customize(SslConnectorCustomizer.java:69) ~[spring-boot-3.4.1.jar:3.4.1]
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.customizeSsl(TomcatServletWebServerFactory.java:383) ~[spring-boot-3.4.1.jar:3.4.1]
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.customizeConnector(TomcatServletWebServerFactory.java:359) ~[spring-boot-3.4.1.jar:3.4.1]
        at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:212) ~[spring-boot-3.4.1.jar:3.4.1]

SslConnectorCustomizer uses AbstractHttp11JsseProtocol which seems to have been removed. However, I think this can be reworked to use AbstractHttp11Protocol instead, regardless of Tomcat 11, and there should be no need to cast down to AbstractHttp11JsseProtocol, unless I am missing something else.

I realize that Tomcat 11 is not officially supported, but this change seemed like a step in the right direction, and a small one at that with I suspect no loss of functionality. I am happy to put together a pull request if this is something you'd like to see.

Thank you.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 16, 2025
@snicoll
Copy link
Member

snicoll commented Jan 16, 2025

There are many more things to consider before we can look at Tomcat 11. This is going to be tackled in the Spring Boot 4 milestones but we're not there yet.

@snicoll snicoll closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2025
@snicoll snicoll added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 16, 2025
@wilkinsona
Copy link
Member

wilkinsona commented Jan 16, 2025

That said, we could consider this in a similar manner to #42730 and #42731. We'd have to decide if it's worth the risk, though.

#42730 added a smoke tests to cover the basics with Tomcat 11. It does not use SSL. #42731 removed the use of some deprecated Tomcat API that should have already been removed in Boot 3.3. The change proposed here is quite different as it would affect everyone using Tomcat and SSL and, therefore, brings with it much greater risk.

apache/tomcat@2b4be93 is the commit that removed AbstractHttp11JsseProtocol in Tomcat 11. As far as I can tell, we could safely move to using AbstractHttp11Protocol with Tomcat 10.1.x as it provides all of the methods that we need for SSL customization. Let's decide if this is a risk we want to take. If it is, we can ask Mark Thomas if my assessment's accurate before proceeding.

@wilkinsona wilkinsona added the for: team-meeting An issue we'd like to discuss as a team to make progress label Jan 16, 2025
@snicoll snicoll reopened this Jan 16, 2025
@snicoll snicoll added status: waiting-for-triage An issue we've not yet triaged and removed status: declined A suggestion or change that we don't feel we should currently apply labels Jan 16, 2025
@wilkinsona
Copy link
Member

@markt-asf Is changing the code in SslConnectorCustomizer to refer to AbstractHttp11Protocol rather than AbstractHttp11JsseProtocol safe to do in Boot 3.x which has a Tomcat 10.1 baseline?

@wilkinsona wilkinsona added status: waiting-for-internal-feedback An issue that needs input from a member or another Spring Team and removed for: team-meeting An issue we'd like to discuss as a team to make progress labels Jan 20, 2025
@markt-asf
Copy link

markt-asf commented Jan 20, 2025

Should be, yes. There is no APR/native Connector/Endpoint in 10.1.x.

@wilkinsona
Copy link
Member

Thanks, Mark.

@wilkinsona wilkinsona added this to the 3.4.x milestone Jan 21, 2025
@wilkinsona wilkinsona added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged status: waiting-for-internal-feedback An issue that needs input from a member or another Spring Team labels Jan 21, 2025
@wilkinsona wilkinsona changed the title Tomcat SSL Customization: Replace AbstractHttp11JsseProtocol with AbstractHttp11Protocol Avoid overly specific casting in SslConnectorCustomizer Jan 21, 2025
@wilkinsona wilkinsona self-assigned this Jan 21, 2025
@wilkinsona wilkinsona modified the milestones: 3.4.x, 3.4.2 Jan 21, 2025
arefbehboudi pushed a commit to arefbehboudi/spring-boot that referenced this issue Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

5 participants