404 when deployed in production mode

I have 2 apps using version 14. Both are deployed to a production server. The first is a very simple single page web app using version 14.1.2.

@Route(value = "")
class MainLayout extends VerticalLayout implements RouterLayout, PageConfigurator {
    MainLayout() {
	// entire app consists entirely of Label, HorizontalLayout, and HTML components

That app is working fine in production. The other app is significantly more complex and uses version 14.2.0.

@PWA(name = "WODiq", shortName = "WOD", startPath = "login")
@CssImport(value = "./styles/menu-bar-button.css", themeFor = "vaadin-menu-bar-button")
@CssImport(value = "./styles/context-menu-list-box.css", themeFor = "vaadin-context-menu-list-box")
public class MainLayout extends AppLayout {
@Route(value = "")
@PageTitle("WODiq Login")
public class LoginView extends Div {

This app works fine while running in the embedded Tomcat instance in IntelliJ. However, when built in production mode and deployed the same Tomcat instance as the other app, it returns a 404. All of the Tomcat logs look normal. Has anyone seen a similar issue or have an idea how to start debugging? Thanks in advance.

How does the URL look like you are calling when it’s deployed to Tomcat?

You may need to add the context root.

Here is the log of the deployment

19-Jun-2020 01:03:40.676 INFO [main]
 org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive 
[/opt/tomcat/webapps/wodiq.war] has finished in [3,586]

I also tried adding to application.properties


When testing a deployment, I typically click on the app path in Tomcat Manager before entering the URL in a browser. But entering the URL (http://:8080/wodiq) in a browser gives the same 404. Everything follows the same approach used in the Vaadin app the works and runs in the same Tomcat instance. It just has a different context path.

Are you building the application with production mode?

Yes, but I’m starting to think the issue is with that server. I can build it in production mode and deploy it to a different server and it works. I don’t know why I didn’t think to try that sooner.

Maybe it wasn’t the server after all. I deployed it to another production server and got a 404 there too. The Tomcat instance that it does run on is my development box. It’s the same .war file. It works in my local Tomcat and doesn’t work in the Tomcat instances of 2 other servers. None of the Tomcat logs show any issues. And a different Vaadin 14 app runs just fine in all 3 of the Tomcat instances. I don’t how you debug something like that.

Hi Brian,

Just off-the-cuff question, have you checked that its not deployed under /wodiq/woqiq? I once experienced that b/c of a configuration issue.

May also consider adding a static file in the root of the app (html, image or so) and load it in a browser That will atleast confirm whether the war is deployed correctly.

see also this thread if you are using spring security:

Hi Martin

The context path is correct. It’s even as expected in the tomcat logs. I added a static html file in the app root and that doesn’t work either. I don’t understand how there can be a deployment issue without any warnings or errors in any of the tomcat logs. Moreover, tomcat manager shows the app as running. Whenever I’ve had a deployment issue in the past, it’s immediately obvious because tomcat manager will show the app as not running.

Again, the app runs without issue on the 3 machines I have at home, one of which is almost identical to the virtual server that I’m trying to deploy on… Debian, Java 11, Tomcat 9. I’m almost certain the virtual server is configured just like my local server. I’ve tried 2 different virtual servers on 2 different providers with the same result on both. I’m using Spring Boot, but not Spring security. I’ve deployed Vaadin 14/Spring Boot app that’s just plain text html on the same Tomcat instance on the same server and it runs and creates its application log. The fact that the other app doesn’t create its application log makes me think that Spring isn’t doing any of the processing that it normally does before main gets called. I think that Tomcat thinks the app is deploying and running, but it’s actually not even though there are no errors in any of the Tomcat logs and the managers shows it as running.

If anyone else runs into this, I was able to run the app using the embedded Tomcat in Spring Boot. I guess the lesson is don’t install Tomcat if you’re using Spring Boot.