javatomcatdeploymentvaadin23

Vaadin application isn't working on the Tomcat


I finally was able to deploy my Vaadin application to the Tomcat 9 without any errors. The Tomcat status shows status as running and log has no errors. The tail of it looks like this:

2023-03-08 21:35:22.487 INFO 64412 --- [alina-utility-2] o.g.e.EncyclopediaApplication : Started EncyclopediaApplication in 9.009 seconds (JVM running for 2059.387) 2023-03-08 21:35:22.517 INFO 64412 --- [alina-utility-2] c.v.flow.server.startup.ServletDeployer : Skipping automatic servlet registration because there is already a Vaadin servlet with the name springServlet 2023-03-08 21:35:22.517 WARN 64412 --- [alina-utility-2] c.v.f.s.c.JSR356WebsocketInitializer : Atmosphere already initialized 2023-03-08 21:35:22.575 INFO 64412 --- [alina-utility-2] c.v.f.s.VaadinServletContextInitializer : Search for VaadinAppShell took 57 ms 2023-03-08 21:35:22.708 INFO 64412 --- [alina-utility-2] c.v.f.s.DefaultDeploymentConfiguration : Vaadin is running in production mode.

The following EXPERIMENTAL features are enabled:

  • Use Webpack for front-end builds (Deprecated)

Nevertheless, I can't see my web page. I have in my main view

@Route(value = "")
@PreserveOnRefresh
public class EncyclopediaMainLayout extends VerticalLayout {

but I can't see my web page in the browser. I see only this: enter image description here

I did try to change the @Route value and redeploy my app. In this case I am getting 404 code. So, what is going on? Where is my application? Please help


Solution

  • Deploying a web applications in Tomcat is done by copying the application's war-archive to the webapps directory of tomcat or copying the directory containing the application to the webapps directory of tomcat.

    Let's say the directory with your application is called vaadin. Or maybe you have an archive named vaadin.war. In both cases Tomcat deploys the application to the following address:

    http://hostname:port/vaadin
    

    In this example, /vaadin is called the context path in tomcat terminology.

    See more information in tomcat manual

    On how to change the default behavior see the following question/answer