spring-boot
spring-boot copied to clipboard
JettyServletWebServerFactory$LoaderHidingResource,list() throw ProviderMissmatchException, unable to Scan tld file in War package
Envrionment: upgrade from Spring2.6.x to SpringBoot3.2.0
Scenario: I want to use custom jsp tagLib in production war scenario , my startup command similar with java -jar fool.war
├── resources
│ ├── application.yml
│ └── logback.xml
└── webapp
└── WEB-INF
├── taglib
│ └── demo.tld
└── views
└── hello.jsp
CurrentSituation: package war can't load custom taglib will throw ProviderMissmatchException and ignored ,package jar everything is ok
Debug: I dive into source, I found JettyServletWebServerFactory come to use jasper TldScanner scanResourcePath , finally will call JettyServletWebServerFactory$LoaderHidingResource list() method.
In springBoot 2.6.x the LoaderHidingResource list() method has no filter condition, so thats fine
The resource filters in both versions but it does so slightly differently due to changes in Jetty's APIs. In 2.x, the filtering is done in addPath:
https://github.com/spring-projects/spring-boot/blob/5490e73922b37a7f0bdde43eb318cb1038b45d60/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java#L566-L571
In 3.x, to align with breaking changes in Jetty, it's now done in list():
https://github.com/spring-projects/spring-boot/blob/676b6334d39f84f30e5177830e65bde354f9bd83/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java#L690-L698
We can't remove this filtering as it's the reason that this custom resource exists. The second and third screenshots that you've shared appear to be JDK code making its behavior out of our control. We may be able to alter the path creation but it's hard to say without knowing more about how things have got into this situation. To help us with that, please provide a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
@wilkinsona sorry for delaying few days,this is seperate repository for the issue
environment: idea intellj 2023 zulu jdk 17.0.9-macos
situation:
- Idea intellj SpringbootApplication everything is ok , i think thats because idea intell setting current project path to USER.DIR automatictally when startup application , so we can find custom taglib by using PathResource
- package jar everything is ok.
- packaging war custom taglib not found ,500 error.