Resources not served when deploying multiple Vaadin applications

We have a legacy Java application running inside Tomcat, it’s really an exploded war with a servlet deployed to it.
We had been using Vaadin 21 deployed as a servlet (inside its own jar, plus dependency jars) into this environment, and this worked as it’s all deployed into the same servlet context.

We recently upgraded to Java 17, and have upgraded our Vaadin version from 21 to 24 successfully (hooray!).

However, something we are trying to do is to deploy a second Vaadin application (in a separate jar on a separate route) into this same servlet context. And, it sort-of worked, but we ran into a strange issue in which when 2 separate Vaadin applications are deployed, resources (styles, javascript etc) only get loaded for one of them, and the other is missing all fields, buttons, styles.

I’ve tried using the @WebServlet annotation to differentiate the two, but perhaps I’ve not configured it correctly (I can post my version if this is the right path to go down?)

Does anybody have any idea what might be going on here, or how I can troubleshoot this further? The root of the problem is, when there’s two Vaadin apps deployed together, only one loads its resources.

I have no idea if that’s even supposed to work, but just as a sanity check, does it work if you deploy the apps to different servlet contexts?

Because of the references in the second app, and static initializers, it does not load as a war (throws an exception when I attempt to navigate to the page)

However I’m fairly confident it would have loaded if it weren’t for the static initializer legacy code.

I think a simpler workaround for this, that I just thought of last night, is to just group the code together into a single Vaadin application / servlet, and have separate @Route annotations defined for each (they already had @Route annotations anyway)

Thanks for the response @ollit.1

1 Like