-
Notifications
You must be signed in to change notification settings - Fork 375
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
Spring Setup and Mime type issue #10017
Comments
It sounds like this might be a better question for a Spring Boot forum? GWT doesn't provide any file-serving code for other server implementations, and I don't think you're reporting this issue for the Dev Mode server (implemented with Jetty)? |
Is there any good information on getting GWT and Spring to interact? |
Have you checked the contents of the nocache.js file in browser dev tools / network tab? Maybe it contains a JSON formatted error produced by spring boot and thus spring boot uses JSON MIME type. If the browser really receives JS content in the nocache.js file, then you should probably ask the springboot people why springboot provides a wrong mime type for JS files. |
Or maybe I need to figure out why it is saying the file doesn't exist. |
Thie maven archetype generates a working GWT + Spring Boot project: https://github.com/NaluKit/gwt-maven-springboot-archetype. Based on this archetype, I have several projects using Spring Boot and never ran into this error. May be you can generate a project using this archetype creator and check if this one is working. BTW, are you working with Windows? If yes, you might check this: |
The reason is that the folder with the nocache.js is not being found which is leading to the nocache.js itself not being found. When running from IntelliJ it isn't looking at my war file. Have to look at some configurations and then figure out why Docker is not finding my main class |
Without knowing your set up, it is hard to say what's going wrong. Using GWT with Spring Boot is a little bit tricky. You need to add the launcherDir to the Spring Boot class path. Something like that in the application.yaml should do the job:
But without seeing your project, it is hard to help. Just generate a project using the maven archetype builder and check the set up. Also, keep in mind, before starting Spring Boot, the code server must be running. Otherwise, the launcherDir is not created. So, wait until you see the code server url in the terminal window before starting the Spring Boot server. |
If the file isn't being found, I'm not sure why you would get a json mime type back - unless maybe there is a servlet preventing loading any files from the filesystem (or the war), and is treating every call as a "rest" (or other json-over-http) call, just to a service/type that doesn't exist? |
How should the jar be setup for GWT with Spring? We use gradle to build. I can get things to build, but I don't think the files are in the right places. |
Without seeing the rest of your build or code, it is hard to make concrete suggestions - Gradle, with or without plugins, is extremely flexible, as you can run any code as part of the build process, so nearly anything could be produced as part of that build. Instead of approaching it from this angle, I'd suggest you start with these questions to take a closer look at what is happening:
|
GWT version: 2.11
Browser (with version): Chrome 129.0.6668.101
Operating System: Windows 11
Description
I'm working on moving our GWT applications to cloud servers and having them run with Springboot. When I try to run with Spring and load the page it is giving me the error
Refused to execute script from 'http://127.0.0.1:8888/healthunderwritingdashboard/healthunderwritingdashboard.nocache.js' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.
The nocache file is definitely not a json file but it seems it is being detected as one. What can be done to fix the content type of the nocache.js file so it isn't coming up as json but as javascript as it should be.
Steps to reproduce
Running a GWT application with Springboot
Known workarounds
Links to further discussions
The text was updated successfully, but these errors were encountered: