Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Vaadin fails to start with Uncaught SyntaxError: Unexpected token < (r.onre
Hi!
I'm using Vaadin 7.5.8 with Tomcat 8.0.23 which works fine.
Recently I encountered a startup problem with later Tomcat versions (8.0.23+).
Application loads vaadinPush.js & vaadinBootstrap.js fine, but vaadinBootstrap throws this error and the app fails to start (no visible errors on page, just endless loading indicator):
Vaadin push loaded
vaadinBootstrap.js?v=7.5.8:14 Vaadin bootstrap loaded
vaadinBootstrap.js?v=7.5.8:14 init application DC2WEB-2010233537 Object {theme: "dc2_webtheme", versionInfo: Object, widgetset: "fi.invian.domacare2.web.DesktopAppWidgetSet", comErrMsg: Object, authErrMsg: Object…}
vaadinBootstrap.js?v=7.5.8:14 loadTheme ./VAADIN/themes/dc2_webtheme 7.5.8
vaadinBootstrap.js?v=7.5.8:14 load widgetset ./VAADIN/widgetsets/fi.dc2.web.DesktopAppWidgetSet/fi.invian.domacare2.web.DesktopAppWidgetSet.nocache.js fi.invian.domacare2.web.DesktopAppWidgetSet
vaadinBootstrap.js?v=7.5.8:14 Fetching root config
vaadinBootstrap.js?v=7.5.8:14 sending request to https://localhost:9001/DC2_WEB/?debug&v-1446636770284
vaadinBootstrap.js?v=7.5.8:14 Got root config response <!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/qtip2/2.2.1/jquery.qtip.min.js"></script>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=11;chrome=1">
<style type="text/css">html, body {height:100%;margin:0;}</style>
<link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./VAADIN/themes/dc2_webtheme/favicon.ico">
<link rel="icon" type="image/vnd.microsoft.icon" href="./VAADIN/themes/dc2_webtheme/favicon.ico">
<meta name="viewport" content="user-scalable=no,initial-scale=1.0">
<meta name="msapplication-tap-highlight" content="no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
</head>
<body scroll="auto" class=" v-generated-body">
<div id="DC2WEB-2010233537" class=" v-app dc2_webtheme desktopapplication">
<div class=" v-app-loading"></div>
<noscript>
You have to enable javascript in your browser to use an application built with Vaadin.
</noscript>
</div>
<script type="text/javascript" src="./VAADIN/vaadinPush.debug.js?v=7.5.8"></script>
<script type="text/javascript" src="./VAADIN/vaadinBootstrap.js?v=7.5.8"></script>
<script type="text/javascript">//<![CDATA[
if (!window.vaadin) alert("Failed to load the bootstrap javascript: ./VAADIN/vaadinBootstrap.js?v=7.5.8");
if (typeof window.__gwtStatsEvent != 'function') {
vaadin.gwtStatsEvents = ;
window.__gwtStatsEvent = function(event) {vaadin.gwtStatsEvents.push(event); return true;};
}
vaadin.initApplication("DC2WEB-2010233537",{
"theme": "dc2_webtheme",
"versionInfo": {
"vaadinVersion": "7.5.8",
"atmosphereVersion": "2.2.7.vaadin1"
},
"widgetset": "fi.dc2.web.DesktopAppWidgetSet",
"comErrMsg": {
"caption": "Communication problem",
"message": "Take note of any unsaved data, and <u>click here</u> to continue.",
"url": null
},
"authErrMsg": {
"caption": "Authentication problem",
"message": "Take note of any unsaved data, and <u>click here</u> to continue.",
"url": null
},
"sessExpMsg": {
"caption": "Session Expired",
"message": "Take note of any unsaved data, and <u>click here</u> to continue.",
"url": null
},
"vaadinDir": "./VAADIN/",
"debug": true,
"standalone": true,
"heartbeatInterval": 300,
"serviceUrl": "."
,"widgetsetUrl":"./VAADIN/widgetsets/fi.dc2.web.DesktopAppWidgetSet/fi.dc2.web.DesktopAppWidgetSet.nocache.js","offlineEnabled":true});
//]]></script>
</body>
</html>
localhost/:1 Uncaught SyntaxError: Unexpected token <r.onreadystatechange @ vaadinBootstrap.js?v=7.5.8:159
vaadinBootstrap.js?v=7.5.8:14 Widgetset registered fi.dc2.web.DesktopAppWidgetSet
Further debugging reveals that error happens in JSON.parse():
var updatedConfig = JSON.parse(text);
text "<!DOCTYPE html>\n<html>\n <head>\n <script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js\"></script>\n <script type=\"text/javascript\" src=\"//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js\"></script>\n <script type=\"text/javascript\" src=\"//cdn.jsdelivr.net/qtip2/2.2.1/jquery.qtip.min.js\"></script>\n <script type=\"text/javascript\" src=\"//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js\"></script>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=11;chrome=1\">\n <style type=\"text/css\">html, body {height:100%;margin:0;}</style>\n <link rel=\"shortcut icon\" type=\"image/vnd.microsoft.icon\" href=\"./VAADIN/themes/dc2_webtheme/favicon.ico\">\n <link rel=\"icon\" type=\"image/vnd.microsoft.icon\" href=\"./VAADIN/themes/dc2_webtheme/favicon.ico\">\n <meta name=\"viewport\" content=\"user-scalable=no,initial-scale=1.0\">\n <meta name=\"msapplication-tap-highlight\" content=\"no\">\n <meta name=\"apple-mobile-web-app-capable\" content=\"yes\">\n <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\">\n </head>\n <body scroll=\"auto\" class=\" v-generated-body\">\n <div id=\"DC2WEB-2010233537\" class=\" v-app dc2_webtheme desktopapplication\">\n <div class=\" v-app-loading\"></div>\n <noscript>\n You have to enable javascript in your browser to use an application built with Vaadin.\n </noscript>\n </div>\n <script type=\"text/javascript\" src=\"./VAADIN/vaadinPush.debug.js?v=7.5.8\"></script>\n <script type=\"text/javascript\" src=\"./VAADIN/vaadinBootstrap.js?v=7.5.8\"></script>\n <script type=\"text/javascript\">//<![CDATA[\nif (!window.vaadin) alert(\"Failed to load the bootstrap javascript: ./VAADIN/vaadinBootstrap.js?v=7.5.8\");\nif (typeof window.__gwtStatsEvent != 'function') {\nvaadin.gwtStatsEvents = ;\nwindow.__gwtStatsEvent = function(event) {vaadin.gwtStatsEvents.push(event); return true;};\n}\nvaadin.initApplication(\"DC2WEB-2010233537\",{\n \"theme\": \"dc2_webtheme\",\n \"versionInfo\": {\n \"vaadinVersion\": \"7.5.8\",\n \"atmosphereVersion\": \"2.2.7.vaadin1\"\n },\n \"widgetset\": \"fi.dc2.web.DesktopAppWidgetSet\",\n \"comErrMsg\": {\n \"caption\": \"Tiedonsiirto-ongelma\",\n \"message\": \"Ota tärkeät tiedot muistiin ja jatka painamalla <u>tästä</u>\",\n \"url\": null\n },\n \"authErrMsg\": {\n \"caption\": \"Autentikaatio-ongelma\",\n \"message\": \"Ota tärkeät tiedot muistiin ja jatka painamalla <u>tästä</u>\",\n \"url\": null\n },\n \"sessExpMsg\": {\n \"caption\": \"Istunto aikakatkaistu\",\n \"message\": \"Ota tärkeät tiedot muistiin ja jatka painamalla <u>tästä</u>\",\n \"url\": null\n },\n \"vaadinDir\": \"./VAADIN/\",\n \"debug\": true,\n \"standalone\": true,\n \"heartbeatInterval\": 300,\n \"serviceUrl\": \".\"\n,\"widgetsetUrl\":\"./VAADIN/widgetsets/fi.dc2.web.DesktopAppWidgetSet/fi.dc2.web.DesktopAppWidgetSet.nocache.js\",\"offlineEnabled\":true});\n//]]></script>\n </body>\n</html>"
The payload contains the vaadin bootstrap HTML code...
I went through Tomcat changelog, but couldn't pinpoint any exact cause.
I have tested that Tomcat 8.0.23 works fine, but 8.0.24 stops working
I also saw a similar error posted before, but disabling/reseting browser cache did not solve the issue.
Any pointers would be greatly appreciated!
I upgraded my Tomcat to verify your problem, but I upgraded
to apache-tomcat-8.0.28 -- this works flawlessly for me.
So maybe you just upgrade as well and forget about the hiccup?
Or did you try 8.0.28 already (you say 'later versions' have this problem)?
Thanks for your response Enver!
I just tried with apache-tomcat-8.0.28 and the issue was not resolved.
Then I tried the parking demo also with 8.0.28 with the same result:
Creating Application Cache with manifest https://localhost/parking/VAADIN/widgetsets/com.vaadin.demo.parking.widgetset.ParkingWidgetset/safari.manifest
(index):1 Application Cache Checking event
(index):1 Application Cache Error event: Manifest fetch failed (9) https://localhost/parking/VAADIN/widgetsets/com.vaadin.demo.parking.widgetset.ParkingWidgetset/safari.manifest
localhost/:1 Uncaught SyntaxError: Unexpected token <r.onreadystatechange @ vaadinBootstrap.js?v=7.5.9:159
com.vaadin.demo.parking.widgetset.ParkingWidgetset-0.js:4718 Wed Nov 11 11:11:09 GMT+200 2015 com.vaadin.addon.touchkit.gwt.client.offlinemode.OfflineModeEntrypoint
INFO: Dispatching: null -> APP_STARTING flags=false true false
com.vaadin.demo.parking.widgetset.ParkingWidgetset-0.js:4718 Wed Nov 11 11:11:09 GMT+200 2015 com.vaadin.addon.touchkit.gwt.client.offlinemode.OfflineModeEntrypoint
INFO: Network OFFLINE (APP_STARTING)
com.vaadin.demo.parking.widgetset.ParkingWidgetset-0.js:4718 Wed Nov 11 11:11:09 GMT+200 2015 VOverlay
WARNING: Could not determine ApplicationConnection for Overlay. Overlay will be attached directly to the root panel
com.vaadin.demo.parking.widgetset.ParkingWidgetset-0.js:4718 Wed Nov 11 11:11:11 GMT+200 2015 com.vaadin.addon.touchkit.gwt.client.offlinemode.OfflineModeEntrypoint
INFO: Ping URL ./PING
com.vaadin.demo.parking.widgetset.ParkingWidgetset-0.js:4718 Wed Nov 11 11:11:11 GMT+200 2015 com.vaadin.addon.touchkit.gwt.client.offlinemode.OfflineModeEntrypoint
INFO: Sending a ping request to the server.
com.vaadin.demo.parking.widgetset.ParkingWidgetset-0.js:4718 Wed Nov 11 11:11:11 GMT+200 2015 com.vaadin.addon.touchkit.gwt.client.offlinemode.OfflineModeEntrypoint
INFO: Dispatching: APP_STARTING -> SERVER_AVAILABLE flags=false true false
com.vaadin.demo.parking.widgetset.ParkingWidgetset-0.js:4718 Wed Nov 11 11:11:11 GMT+200 2015 com.vaadin.addon.touchkit.gwt.client.offlinemode.OfflineModeEntrypoint
INFO: Network Back ONLINE (SERVER_AVAILABLE)
localhost/:1 Uncaught SyntaxError: Unexpected token <
I even recompiled the parking widgetset with newest Vaadin (7.5.9), made no difference. Curiously, the manifest fetch failed, but the file itself was accessible from the given link.
The parking demo works as expected in apache-tomcat-8.0.23 (the manifest fetch fails in this case as well).
I'm developing the project on Windows and running it also on Linux, which has the exact same problem.
Hi Risto!
Parking demo nowadays is using Vaadin-7.6.0.alpha5 -- are you saying you did just that?
Just tried it, works flawlessly. Have to say, we're mostly using OSX so if the stock parking demo
works for me but not for you this would be the next thing to look into.
Did you change the Vaadin version to 7.5.8/7.5.9 or not?
Thanks,
Enver
Hi again!
Ahhh, the problem was my server.xml Connector configuration.
I was hitting Tomcat issue #57938, since I was using maxPostSize="0" setting.
Setting it properly to maxPostSize="-1" fixed the issue. This change was done exactly in 8.0.24.
Thanks for your pointers Enver!
And thanks for using our forums, Risto -- hope the thread helps others, too!