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
Classpath files not found in Undertow after migrating to Spring Boot 1.2.7 #4218
Comments
you're not telling anything about the app and how it retrieves those files. One way to easily isolate #4015 would be to run your app on tomcat (or jetty) and see if the same issue happens (that is works in 1.2.6 and breaks in 1.2.7). |
Hi @snicoll , I noticed this error only happens on Solaris sparc, if I try my application on Windows 7 it finds the html file normally. The piece of code which tries to get the file is VaadinServletService.class :
As you can see the servletContext can not reach the resource, any idea? Thanks! |
Where is the resource that you're trying to load via the servlet context? If it's inside an embedded jar then it won't work. |
Have same problem with keystore: Error:
In Spring Boot 1.2.6 it works fine. |
@kkarwows I don't think you have the same problem as you're using Tomcat and this issue is specific to Undertow. Perhaps you're being affected by this change but it's impossible to say from the information you've provided. If you'd like us to investigate please open a separate issue with a sample project that reproduces the problem. |
@kkarwows I've just noticed you're using Tomcat 8.0.20. Why are you overriding the version? You should let Spring Boot provide the version for you. If you use the version that Boot provides, 8.0.28, then I suspect your problem will go away. |
@wilkinsona: I remove tomcat version overriding and it works now, Thanks. |
Hi, @wilkinsona Why in Spring Boot 1.2.6 does it work? My html resource is inside the jar. By the way, I create a fat jar with all resources inside.
Thks! |
@ofbizbrazil I suspect your code accidentally worked in 1.2.6 because #4015 had not been fixed. You probably either need to update your code to use Following @snicoll's suggestion in #4218 (comment) and trying Jetty/Tomcat would also help in diagnosing if this is something that behaves differently only for Undertow. |
hi @philwebb, Sadly I cant change the code VaadinServletService, cause is part of Vaadin framework and not mine code. Please see at. vaadin.com About the bug #4015 why was it a problem? Thanks |
Bug #4015 was a security concern. It basically exposed every resource (including I know that @joshlong did quite a bit of work with the Vaadin team to offer Spring Boot support. I'm not sure what packaging he used. Perhaps he can comment here. Did you manage to try your app with Jetty or Tomcat yet? That would be very helpful in letting us know if the different container engines work in the same way. |
Vaadin based apps are working fine with both jar and war deployment. We've been working with them on the Spring Boot support. I don't think it's fair to say that the issue is on either our side or Vaadin's until we can actually see the problem. As we asked three times already, please try your app with Tomcat or Jetty. It's a three lines change in your project. |
Hi @philwebb, I tried with Jetty and the same error happens. If I try to change my pom to WAR, the zip format can not load external resources (application.properties). How to solve it? |
@ofbizbrazil I've no idea how to fix your specific issue without looking in detail at the code. Perhaps you could create a minimal project that reproduces the issue. There's also this Getting Started Guide which might help. |
Let's suppose if I want to load a resource via servletContext, for example:
This will it not work anymore? From now on, I can only do via Classpath.getResourceAsStream()? Tks |
@ofbizbrazil If you'd like us to investigate this any further, please provide the requested sample project that reproduces the issue. As things stand we're just going round in circles wasting our time and yours. |
But my point is: servletContext.getResourceAsStream("/image.png") will not work anymore? By the way I changed my pom to war, and the error still persists, when tries to load the resource from servletContext.getResourceAsStream. It seems fat JAR/WAR is not working.
|
Hi all. So, my html files are located inside the WAR at \VAADIN\themes\test\layouts*. For example:
When I try to access a screen, on console says:
This error happens because Vaadin class tried to get a resource using servletContext.getResourceAsStream from \VAADIN\themes\test\layouts folder Is there any solution to fix it? |
Vaadin looks for the template files for As these files are in published directories anyway (you should be able to load With Vaadin Spring 1.0 final release, you can customize the
If you use If this helps, please let us know so that we (at Vaadin and/or Pivotal) can try to find a way to fix this for other users. Note that another workaround would be to use the constructor |
Hi @hesara, Excellent explanation, I tried to use CustomLayout(InputStream) but I noticed it gets the files from resource folder. As I am settting on webapp folder the template files it will only find them when I create the fat jar. My next step is to test is create a VaadinServletService and see what happens, but I am afraid about the location of resources. Tks |
I still wonder if servletContext.getResourceAsStream("/image.png"); will not work anymore? Tks! |
Hi,
I have migrated my Spring Boot application to 1.2.7 version and after that some html files which are inside my jar's could not be found in Undertow. My application tries to read those html files to use on my CustomLayout class (Vaadin framework).
I noticed there's a ticket called #4015 which says about something protecting files from classpath in Undertow. Before migrating it, the version 1.2.6 was working fine and did not face any error about files missing.
Is there any cause about it? What to do now?
Cheers,
The text was updated successfully, but these errors were encountered: