-
Notifications
You must be signed in to change notification settings - Fork 62
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 WebMVC support? #38
Comments
@hurelhuyag no I haven't tried that (I did not use Spring MVC so far). Does the exception message say more about the error? There was a slightly similiar error with Ktor Framework (#35), which was resolved by setting another classloader for the jte. Do you have your sample project in a repository? If you want, I'll have a look at it. |
here is my sample https://github.com/hurelhuyag/demo-spring-jte |
Thanks for sharing. How do I run the sample? The main method is commented out and it seems to be not related to Spring. From looking at the code, I noticed that |
It's war project. You need tomcat supported IDE. IntelliJ or something. |
I'm working with IntelliJ. But without some setup instructions I won't be able to help you. I'm confused by your setup. You have spring boot configured in the pom, but you run as WAR on local Tomcat? Did you try my suggestion about the Config class? |
Here is bit old guide: https://mkyong.com/intellij/intellij-idea-run-debug-web-application-on-tomcat/ |
sample repo cleaned and tomcat9 plugin added. Now can run with this command mvn package org.codehaus.cargo:cargo-maven2-plugin:run |
Thanks! I was able to reproduce the error. It was a bit hard to debug, but the problem is that Now I understand your previous question about hot reload a lot better. You started with precompiled templates and now you tried hot reload, but it does not work with WAR deployments. I probably won't be able to look into the WAR / Tomcat issue anytime soon. None of my projects use that setup anymore, instead they run an embedded webserver and start with a simple main method, so my motivation for application server support is not very high :-) Since this question is about Spring MVC, maybe Spring Boot is an option for you? I forked your demo repository and changed it to a Spring Boot application (https://github.com/casid/demo-spring-jte). Now hot reloading works as expected. To give it a try, you'd need to clone it and run/debug |
It works on spring-boot. Great. But I still don't understand what makes different spring-boot still uses tomcat9. |
The difference is that Spring Boot uses an embedded Tomcat, so the application class loader is used. A standalone Tomcat runs every deployed WAR in isolation with its own classloader (see https://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html). And apparently with this setup the Java compiler behaves differently, too. Are you forced to use a standalone Tomcat by a client or so? If not, I'd recommend to try the Spring Boot way. The development experience is a lot better. Imho running that in production, too. |
@hurelhuyag In
with
in
to
|
Hey @izogfif, thanks for sharing! I added a link to your repostitory to the jte readme. |
Hi, Did you try to integrate with SpringMVC? I tried to use minimal spring-webmvc project. But it can't compile templates.
Here is my minimal MVC setup.
Error:
The text was updated successfully, but these errors were encountered: