I work in a closed organization, our application does not yet utilize the cloud. I would like to deploy my awesome Vaadin application first to Tomcat so I can demonstrate it running on one of our internal Linux servers. After that, I would like to deploy it to WebSphere to sit alongside the rest of our enterprise applications.
I see deployment instructions for all kinds of cloud platforms, AWS, Microsoft as Azure etc.
I am having a hard time getting a generated war file to run on tomcat 10. Documentation and an example would really help… It would be great if someone created a video demonstrating deployment to Tomcat including using maven to deploy it.
I do not know why it is not working. I have been beating my head against it, is it the versions I am using?, Is it tomcat 10, is it Java 21, or is it just my application start up. I have not really looked at logs. Knowing where to look would probably help.
What are the symptoms? Note that by default Tomcat deploys using the application name as deployment path. Did you use correct url to open the application? Tomcat 10 works at least upto Java 24, I deployed some Vaadin app just last week with that config. Just drop the WAR to webapp folder of Tomcat. Are your deploying on local machine or remotely?
I could bet your issue is the “development mode”, which is the default for Vaadin projects (IMO a wrong default). The development mode uses front-end tooling for you behind the scene, so that you can use add-ons, customize the theme etc. dyring the development phase. Server probably doesn’t allow to automatically install front-end tooling (which is a good thing) → failure during start up.
When making an actual deployment, you should prepare the front-end bundle upfront → then the server with minimal tooling works better and the end users have more optimal user experience. Typically this is triggered in Maven built projects using “production” profile:
mvn package -Pproduction
More about production builds here:
BTW. I urge you to find out a way to check the logs on that server anyways, as suggested by @SimonMartinelli. That should contain pretty good error message, or at least some hints about the development mode.
I cloned your github project and uploaded the resulting war file via scp to our remote linux server running tc10. It worked! Thank you for creating that!
I am comparing what you created with a bare bones project created with start.vaadin. I am comparing the two project to find what the difference is so far I have not figured it out.
I built it using ./mvnw clean package -Pproduction
When i deploy the project I got a couple of errors i need to work through.
I see to have narrowed it down to the fact that I had a theme defined
I removed that and it ran after i added the missing ClockConfig.java for the skeleton ToDo app.
Now i just need to figure out how to add a theme and have it go to the war file.
Maybe that is just automatic.
Thank you so very much for your help and blog!
A couple of follow up questions:
Is there an easy way to have the app run locally in my intellij AND build a war file for development? It seems the Application.java is different between the two targets.
I guess i could just comment out one or the other and change the target from war to jar?
I noticed you defined the application class VaadinWarApplication can it be named anything? Such as just plain old Applicaiton.java