Archie
Archie

Reputation: 5421

Vaadin23 application won't load - script vaadin-bundle-xxx.cache.js 404 not found

I'm working on a Vaadin application running under tomcat in a WAR file.

I'm trying to simply upgrade it from Vaadin 22 to Vaadin 23.

It was loading reliably with Vaadin 22 but now it fails to load with Vaadin 23.

The WAR file is named pcom.war and within it web.xml contains:

<servlet-mapping>
    <servlet-name>PCOM</servlet-name>
    <url-pattern>/pcom/*</url-pattern>
</servlet-mapping>

Therefore, the URL I trying to load the web application from, and from which Vaadin is failing to load successfully, is: http://localhost:8080/pcom/pcom/.

The index.html generated by Vaadin in META-INF/VAADIN/webapp/index.html in pcom.war contains (line breaks added for clarity):

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<style>body, #outlet {
      height: 100vh;
      width: 100%;
      margin: 0;
    }</style>
<script defer="defer" src="VAADIN/build/vaadin-bundle-67fde5fb08b0f134e867.cache.js"></script>
</head>
<body>
<div id="outlet"></div>
</body>
</html>

Note the src="VAADIN/build/vaadin-bundle-... relative URL. This is correct, relative to index.html as it sits within the META-INF contents of pcom.war:

        0  07-29-2022 14:33   META-INF/
       79  07-29-2022 14:33   META-INF/MANIFEST.MF
        0  07-29-2022 14:33   META-INF/VAADIN/
        0  07-29-2022 14:33   META-INF/VAADIN/config/
     1844  07-29-2022 14:33   META-INF/VAADIN/config/flow-build-info.json
     1658  07-29-2022 14:33   META-INF/VAADIN/config/stats.json
        0  07-29-2022 14:33   META-INF/VAADIN/webapp/
        0  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/
        0  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/
  1051904  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-1-cfc74d1f13c51748c7ba.cache.js
   259593  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-1-cfc74d1f13c51748c7ba.cache.js.gz
   607425  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-2-737c0b4498b03051df61.cache.js
   158040  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-2-737c0b4498b03051df61.cache.js.gz
    67025  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-3-460383d2eeb67dbda1eb.cache.js
    23477  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-3-460383d2eeb67dbda1eb.cache.js.gz
    27991  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-4-9ba06ea1fd5a6da385f4.cache.js
     8040  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-4-9ba06ea1fd5a6da385f4.cache.js.gz
     3518  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-5-a21e874ef30c99e3575f.cache.js
     1480  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-5-a21e874ef30c99e3575f.cache.js.gz
   138893  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-6-5710b84bf57453285225.cache.js
    46654  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-6-5710b84bf57453285225.cache.js.gz
    86955  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-bundle-67fde5fb08b0f134e867.cache.js
    26514  07-29-2022 14:33   META-INF/VAADIN/webapp/VAADIN/build/vaadin-bundle-67fde5fb08b0f134e867.cache.js.gz
      365  07-29-2022 14:33   META-INF/VAADIN/webapp/index.html
      273  07-29-2022 14:33   META-INF/VAADIN/webapp/index.html.gz

But when I load the application, FireFox inspector shows this error:

enter image description here

Note the reported error loading http://localhost:8080/pcom/VAADIN/build/vaadin-bundle-67fde5fb08b0f134e867.cache.js.

That URL is incorrect and generates a 404 error - I can verify this using curl(1).

However I can use curl(1) to successfully load the correct URL, which is http://localhost:8080/pcom/pcom/VAADIN/build/vaadin-bundle-67fde5fb08b0f134e867.cache.js.

Why does Vaadin 23 rewrite the URL in the index.html file so as to make it unloadable??

FYI, also filed as Vaadin Flow Bug #14239.

UPDATE

Vaadin has reverted the change which caused this problem. Yay.

Upvotes: 1

Views: 274

Answers (1)

Simon Martinelli
Simon Martinelli

Reputation: 36143

The problem can be solved as in the comments of your reported Vaadin bug.

Add /VAADIN/* to the servlet mapping:

<servlet-mapping>
    <servlet-name>VaadinBugServlet</servlet-name>
    <url-pattern>/demo/*</url-pattern>
    <url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>

Upvotes: 1

Related Questions