Skip to content
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

Unable to apply jakartaConverter in spring boot embedded tomcat. #40995

Closed
chirag519086 opened this issue Jun 5, 2024 · 4 comments
Closed

Unable to apply jakartaConverter in spring boot embedded tomcat. #40995

chirag519086 opened this issue Jun 5, 2024 · 4 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@chirag519086
Copy link

Have configured Spring boot 3 application running on embedded tomcat.
Configured tomcat with customized context and webappclassloader to apply jakartaConverter="TOMCAT" property for javax to jakarta migration.
It works fine in standalone tomcat, but spring boot 3 is not transforming 3rd party libraries from javax to jakarta.
Is there anything needs to be configured?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 5, 2024
@wilkinsona
Copy link
Member

The conversion isn't supported in Spring Boot with embedded Tomcat. In this arrangement, the classes of the application and its dependencies aren't loaded by Tomcat's WebAppClassLoader but by Spring Boot's class loader or a JDK class loader so there's no opportunity to perform the conversion. You may want to look at using something like the Eclipse Transformer to perform the conversion at build time rather than at runtime.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2024
@wilkinsona wilkinsona 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 Jun 5, 2024
@chirag519086
Copy link
Author

eclipse transformer is not working for spring boot jar package. It is not iterating through libraries under boot-inf/lib generated from spring-boot-maven-plugin

@wilkinsona
Copy link
Member

The transformation should be applied at build time, before the Spring Boot uber jar is created. If you'd like some further help figuring out how to do that, please follow up on Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.

@chirag519086
Copy link
Author

Thank you for your guidance, but have tried everything to apply transformation during build time for spring boot uber jar but it wasn't transforming dependent jars which are packaged under boot-inf/lib directory. tried to execute transformer plugin on various phases but it worked only for prepare-package phase due to spring-boot-maven-plugin goal/phase conflicts.
Had to write custom transformer plugin https://github.com/chirag519086/jakarta-transformer-plugin for spring boot uber jar transformation.
Thanks for your valuable feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants