Skip to content

Add support for Jakarta servlets#419

Merged
garydgregory merged 1 commit into
apache:masterfrom
garydgregory:feature/jakarta_servlet
Apr 30, 2026
Merged

Add support for Jakarta servlets#419
garydgregory merged 1 commit into
apache:masterfrom
garydgregory:feature/jakarta_servlet

Conversation

@garydgregory
Copy link
Copy Markdown
Member

@garydgregory garydgregory commented Apr 30, 2026

This PR is instead of PR #418 which breaks binary compatibility.

Before you push a pull request, review this list:

  • Read the contribution guidelines for this project.
  • Read the ASF Generative Tooling Guidance if you use Artificial Intelligence (AI).
  • [ ] I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute?
  • Run a successful build using the default Maven goal with mvn; that's mvn on the command line by itself.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.

Copy link
Copy Markdown

@kiril-keranov kiril-keranov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing this! The solution suits well, though applications experiencing the issue would still need to make an adjustment they would now have a working variant

Comment thread pom.xml
<logback.version>1.3.16</logback.version>
<slf4j.version>2.0.17</slf4j.version>
<findsecbugs.version>1.14.0</findsecbugs.version>
<jakarta.servlet-api.version>5.0.0</jakarta.servlet-api.version>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can it be updated to at least 6.0.0?

*/
@Override
public void contextDestroyed(final ServletContextEvent sce) {
final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
Copy link
Copy Markdown

@kiril-keranov kiril-keranov Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the common code of the javax.* and jakarta.* ServletContextCleaners might be extracted to a common location to prevent duplication

Copy link
Copy Markdown
Member Author

@garydgregory garydgregory Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to do that initially but stopped myself. I think the simplest solution for now is to keep the javax and jakarata paths separate. If some subtle difference needs to be accounted for, then it can be dropped in the right class without concern of creating a regression in the other.

Can you test this PR in your use case?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to do that initially but stopped myself. I think the simplest solution for now is to keep the javax and jakarata paths separate. If some subtle difference needs to be accounted for, then it can be dropped in the right class without concern of creating a regression in the other.

Can you test this PR in your use case?

tested it and worked well

@garydgregory garydgregory merged commit d1a8dce into apache:master Apr 30, 2026
9 checks passed
@garydgregory garydgregory deleted the feature/jakarta_servlet branch April 30, 2026 20:33
garydgregory added a commit that referenced this pull request Apr 30, 2026
org.apache.commons.logging.jakarta.ServletContextCleaner #419.
@garydgregory
Copy link
Copy Markdown
Member Author

@kiril-keranov

I merged the PR. Please test again with git master or a snapshot build from https://repository.apache.org/content/repositories/snapshots/commons-logging/commons-logging/1.4.0-SNAPSHOT/

@kiril-keranov
Copy link
Copy Markdown

@kiril-keranov

I merged the PR. Please test again with git master or a snapshot build from https://repository.apache.org/content/repositories/snapshots/commons-logging/commons-logging/1.4.0-SNAPSHOT/

@garydgregory tested with both master branch build and this snapshit build. Looks fine

@garydgregory
Copy link
Copy Markdown
Member Author

@kiril-keranov
Great, thank you. I'll see about publishing a release candidate in the next week or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants