White screen issue trying to deploy Hilla app as a Tomcat servlet

Hello, we were testing around with the framework and decided to try looking at deploying into a tomcat as a servlet, following the official documentation.

On a local instance of tomcat it appears to work properly, but when uploading the war to the testing server all it returns is a white screen with <div id="outlet"></div> inside the body, nothing else. Console does display an error: Uncaught SyntaxError: Invalid or unexpected token ( at indexhtml.cd2e5863.js:1 ). Any idea what may be causing this? Thanks in advance!

As some additional context, since writing the OP (was holding from posting before trying it out):

We tried again on our local instance and noticed the tomcat webapp is deployed from the war, but a 404 is given when trying to access it…

And as for what we did before deploying (maven project):

  • Change packaging from jar to war
  • Enable vaadin.productionMode in the production profile’s properties
  • Add Exclude the dependency on vaadin-dev-server for the production build
  • The Application class was made to extend SpringBootServletInitializer

All this from a project based on the crm tutorial

Add the dependency on vaadin-dev-server for the production build
This you should not do. The vaadin-dev-server is only used for development. Not that it should matter though

My bad, miswrote that. It’s being excluded

<dependencies>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin</artifactId>
        <exclusions>
            <exclusion>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-dev-server</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

The error itself sounds like the browser tries to load the JS bundle indexhtml.cd2e5863.js but instead of getting a JS file it probably gets a bootstrap HTML. Now WHY that would happen is a different question

Yeah, though on local tomcat it’s straight up a 404, not even that

Some additional steps taken, I noticed the steps for making spring boot a servlet may’ve been incomplete. Followed all steps in https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto.traditional-deployment.war but still nothing. And as mentioned, everything in https://hilla.dev/docs/production/overview as well

Will test from scratch with a new generic hilla project, just as to debug this. If that one also ends up failing, I’ll upload it as a repo for reference.

welp, think we found the issue. Our local tomcat environments were both in tomcat 10 (which are unsupported apparently, according to this message from 10 days ago https://discord.com/channels/732335336448852018/1025232403771437136)

And the deployment server is running tomcat 8.5, so just in case we tried running it in tomcat 9 locally aaaaaand it works!

not sure if 100% what caused the issue, or if 8.5 is meant to be supported but hopefully with this we can continue on, for the time being at least :sweat_smile:

Yep

Tomcat 10 is for servlet 5 and Vaadin 23 is for servlet 3

Vaadin 24 will then work on and require the newer version

Or in Hilla versions 1 for Tomcat 9, 2 for tomcat 10

Right, I see now. Good to know, guess we were just unlucky on the versions and on what terms we searched for possible solutions :stuck_out_tongue:

Thanks for the details on that!

Hopefully other people will not run into this now thanks to https://github.com/vaadin/flow/pull/14842