-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Support for last-modified resolution in Tomcat's unpackwar=false mode [SPR-13393] #17434
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
Comments
Stéphane Nicoll commented This is the issue tracker for the Spring framework. That integration is provided by Spring Boot so please open an issue in the Spring Boot tracker |
Gaurav Rawat commented |
Andy Wilkinson commented Having investigated the Spring Boot issue a little more, I think this actually was the appropriate place to report the issue. The problem affects any use
|
Juergen Hoeller commented Fixed through accepting Tomcat's Juergen |
Gaurav Rawat commented great thought that was the issue .Can this be taken in the latest 4.2 build snapshot or we have to wait Regards |
Juergen Hoeller commented I've just pushed it, so the upcoming Juergen |
Juergen Hoeller commented Unfortunately, the fix turns out to be incomplete... reopening the issue for another pass. Juergen |
Juergen Hoeller commented I'm resolving this in a slightly different way, with a new This will show up in the upcoming Juergen |
Gaurav Rawat commented Hi java.io.FileNotFoundException: Jar URL cannot be resolved to absolute file path because it does not reside in the file system: war:jar:file:/deployment/wars/hfds.0.2.war!/WEB-INF/lib/spring-data-rest-hal-browser-2.4.0.RELEASE.jar at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:218) ~[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.core.io.AbstractFileResolvingResource.getFileForLastModifiedCheck(AbstractFileResolvingResource.java:67) ~[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE] |
Juergen Hoeller commented Andy Wilkinson, we did test this against 4.2.3, didn't we? Are you aware of any limitations there still? Juergen |
Andy Wilkinson commented We did indeed. I'm not aware of any limitations. I've just tested a small sample app and it was able to serve static content both from directly within the war and from jars in |
Gaurav Rawat commented HI public static File getFile(URL resourceUrl, String description) throws FileNotFoundException {
Assert.notNull(resourceUrl, "Resource URL must not be null");
if (!URL_PROTOCOL_FILE.equals(resourceUrl.getProtocol())) {
throw new FileNotFoundException(
description + " cannot be resolved to absolute file path " +
"because it does not reside in the file system: " + resourceUrl);
}
try {
return new File(toURI(resourceUrl).getSchemeSpecificPart());
}
catch (URISyntaxException ex) {
// Fallback for URLs that are not valid URIs (should hardly ever happen).
return new File(resourceUrl.getFile());
}
} Full stack trace goes like java.io.FileNotFoundException: Jar URL cannot be resolved to absolute file path because it does not reside in the file system: war:jar:file:/deployment/wars/foo_1.10.war!/WEB-INF/lib/spring-data-rest-hal-browser-2.4.4.RELEASE.jar
at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:218)
at org.springframework.core.io.AbstractFileResolvingResource.getFileForLastModifiedCheck(AbstractFileResolvingResource.java:67)
at org.springframework.core.io.AbstractResource.lastModified(AbstractResource.java:153)
at org.springframework.core.io.AbstractFileResolvingResource.lastModified(AbstractFileResolvingResource.java:169)
at org.springframework.web.servlet.resource.ResourceHttpRequestHandler.handleRequest(ResourceHttpRequestHandler.java:240)
at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:51)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:859)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:237) |
Gaurav Rawat opened SPR-13393 and commented
Hi I am using spring data rest provided HAL browser to view my sprign data rest HAL based api .So far things have been good when I am running it via eclipse or as a spring boot app for testing in my local tomcat on windows.Though when I deploy on aws on a tomcat container (as a spring boot war) I get this weird error as below when I browse to the root or the address of the hal browser /browser/index.html#
-I am still not able to find a valid justification on why its not being able to find the provided hal browser though things work fine in local .Am I missing something can someone please help .Is this a bug with spring framework or otherwise-
This works if unpackwar=true but doesnt if unpackwar is set to false - That seems to cause the real issue
UPDATE
The stack trace shows the issue coming from the code below when unpackw=false ,I get war:jar:file which causes the issue due to this code section in org.springframework.util.ResourceUtils
Not sure it should go to the Spring data bucket or Spring framework in general .
+UPDATE NEW+
ALso after more analysis seems this is not an environment specific issue but it occurs if a resource like HAL_Browser is packed inside a jar and tomcat unpackwar is set to false .In this situation somehow spring is not able to extract contents from the jar file and render them .
Affects: 4.1.7, 4.2 GA
Reference URL: http://stackoverflow.com/questions/32176383/not-able-to-open-spring-default-hal-browser-provided-by-spring-data-rest-on-aws
Issue Links:
Referenced from: commits 302a069, 1c3a668, 155bbf5
Backported to: 4.1.8
The text was updated successfully, but these errors were encountered: