Failed to load the bootstrap javascript: ./VAADIN/vaadinBootstrap.js

Hello,

I need help with the error “Failed to load the bootstrap javascript: ./VAADIN/vaadinBootstrap.js” using Vaadin 7.0.0.rc2.

Here is what I did:

  • Created a new project in Eclipse Juno and the Vaadin plugin (2.0.1.201301081221) with the project wizard (File → New → Other… → Vaadin → Vaadin 7 Project)
    Target Runtime is Tomcat 7
    Configuration is “Vaadin 7, Java 7, Servlet 2.4”
    Deployment configuration “Servlet (default)”
    Checked “Create project template” and left all default values (no portlet version)

  • Built the project and started it within Eclipse via “Run as → Run on Server”
    → Application runs, the “Click me” button shows up and responds

  • Export the project to a war file

  • Deploy the war to other server (Ubuntu 10.04, Tomcat 7, Java 1.7)
    → the above error occurs.

  • Checked with Firebug. The site is trying to load “MyApp/VAADIN/vaadinBootstrap.js”. But in the VAADIN directory, there is no vaadinBootstrap.js

When I follow the above steps for a Vaadin 6-Project, the project runs fine on the Linux-Server. So, in general, my setup seems to work.

How can this be fixed?

Thanks!

In your deployment descriptor (web.xml), do you have the VaadinServlet mapped to some other path than "/"? If you do, you must provide mapping for /VAADIN/ path as well.

Please see section 4.8.3 from here Book of Vaadin (https://vaadin.com/book/-/page/application.environment.html) Class names are from Vaadin 6 but same mapping requirement still applies.

Hello Peter,

sorry for the late response. I did only perform the steps as described in my initial post. I did not modify the web.xml. The web.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>vaadin_7_tst_wiz_1</display-name>
	<context-param>
		<description>
		Vaadin production mode</description>
		<param-name>productionMode</param-name>
		<param-value>false</param-value>
	</context-param>
	<servlet>
		<servlet-name>Vaadin_7_tst_wiz_1 Application</servlet-name>
		<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
		<init-param>
			<description>
			Vaadin UI class to use</description>
			<param-name>UI</param-name>
			<param-value>com.example.vaadin_7_tst_wiz_1.Vaadin_7_tst_wiz_1UI</param-value>
		</init-param>
		<init-param>
			<description>
			Application widgetset</description>
			<param-name>widgetset</param-name>
			<param-value>com.example.vaadin_7_tst_wiz_1.widgetset.Vaadin_7_tst_wiz_1Widgetset</param-value>
		</init-param>
	</servlet>
	<servlet-mapping>
		<servlet-name>Vaadin_7_tst_wiz_1 Application</servlet-name>
		<url-pattern>/*</url-pattern>
	</servlet-mapping>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>
</web-app>

Any idea?

According to your web.xml the widgetset should be compiled to com.example.vaadin_7_tst_wiz_1.widgetset.Vaadin_7_tst_wiz_1Widgetset is this also part of your exported war package? It should be under WebContent/VAADIN/widgetsets.

If you have not used any add-ons you don’t need to compile the widgetset and instead use the precompiled one that comes with vaadin-client-compiled jar. In order to do this remove the widgetset init-param from your web.xml

Any help with this?

Hello Peter,

I solved the issue:

What I found out is that the error occurs only when I follow the hyperlink on the “Tomcat Web Applicaion Manager” after deployment. The error also occurs only in Firefox. Following the link in IE does not produce the error on the target site.

When I access the website directly from a freshly opened window, the page works.

This behaviour is independent from whether the widgetset is included in the web.xml.

Hi,

I have the same problem. I installed necessary plugins in Eclipse IDE and created Vaadin 7 project. Then I tried to run immediately and got the following error:

Failed to load the bootstrap javascript: ./VAADIN/vaadinBootstrap.js

I checked it in firebug and the problem is in the following rows:

if (!window.vaadin) alert(“Failed to load the bootstrap javascript: ./VAADIN/vaadinBootstrap.js”);
vaadin.initApplication(“vaa1-3611611”,{

and the message: vaadin is not defined

Could anyone help me?

Thanks,
Zoltan

The error message originates in that vaadin-server.jar is not deployed correctly so the bootstrap javascript cannot be found. There could be many reasons for this, one thing to check of course is that the project includes the vaadin-server jar (included through Ivy by default) and that it is actually deployed to the server.

Hello,

I have the same issue with my project when I deploy it on Weblogic 11g (10.3.6.0).

I also tried with a newly generated project with the command :

mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.0.0

Both projects are working well with jetty but as soon as I deploy them on Weblogic it’s no more working, I got the same popup saying “Failed to load the bootstrap javascript: ./VAADIN/vaadinBootstrap.js” which is opened at this line:

if (!window.vaadin) alert("Failed to load the bootstrap javascript: ./VAADIN/vaadinBootstrap.js");

I also tried to extract the vaadinBootstrap.js of the vaadin-server.jar but it’s the same.

My war file contains all the vaadin-.jar and as you can see my servlet is mapped to /

    <servlet-mapping>
        <servlet-name>Vaadin Application Servlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

I don’t know what to do… Any idea ?

I just found something new… if I add /VAADIN to my browser url to have something like http://localhost:7001/MyApplication/VAADIN, my application is working fine without any errors.

Strange isn’t it ?

EDIT : mapping the servlet to /VAADIN/* did the tricks and it’s ok but I wasn’t supposed to do that as it was only mapped to /*

EDIT again (sorry for the flood) :

Actually if I access to my application with http://localhost:7001/MyApplication it’s not working, I have to add a / at the end : http://localhost:7001/MyApplication[b]
/
[/b]
I think something is wrong somewhere but I don’t know what…

Tomcat has
some issues with missing trailing slash
, could it be something similar for WebLogic? Or maybe some server configuration related issue?

Actually I don’t think it’s related to server configuration.

I deployed the same application with Vaadin 6.8.7 instead of 7.0.0 on the same server, without touching the server config and I was able to access it using http://localhost:7001/MyApplication (without trailing slash)

Here is my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    <display-name>Vaadin Web Application</display-name>
    <context-param>
        <description>Vaadin production mode</description>
        <param-name>productionMode</param-name>
        <param-value>false</param-value>
    </context-param>
    <servlet>
        <servlet-name>Vaadin Application Servlet</servlet-name>
        <servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
        <init-param>
            <description>Vaadin UI to display</description>
            <param-name>UI</param-name>
            <param-value>test.MyVaadinUI</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>Vaadin Application Servlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Vaadin Application Servlet</servlet-name>
        <url-pattern>/VAADIN/*</url-pattern>
    </servlet-mapping>
</web-app>

With this configuration I can acces to my application either this way http://localhost:7001/MyApplication[b]
/
[/b] (
with
trailing slash) or this way http://localhost:7001/MyApplication[b]
/VAADIN
[/b] (with or without trailing slash)

If I remove this

    <servlet-mapping>
        <servlet-name>Vaadin Application Servlet</servlet-name>
        <url-pattern>/VAADIN/*</url-pattern>
    </servlet-mapping>

I can
only
acces my application this way : http://localhost:7001/MyApplication[b]
/VAADIN
[/b] (with or without trailing slash)

I think it should be something related to Vaadin 7… But I don’t know…

Vaadin 7 uses relative URLs to support proxies and similar setups better. For this to work you must end the URL in a slash as the relative URL, ./VAADIN in this case, should refer to /MyApplication/VAADIN and not /VAADIN. To support using /MyApplication without a trailing slash, VaadinServlet should automatically redirect the user to /MyApplication/, which obviously is not happening in this case. If you fire up your debugger, set a breakpoint at VaadinServlet.handleContextRootWithoutSlash you might be able to tell us what goes wrong in WebLogic.

Ok I did a test in debug mode, here is what I got :

VaadinServlet.handleContextRootWithoutSlash returned
false

If I take the method implementation in detail

protected boolean handleContextRootWithoutSlash(HttpServletRequest request,
            HttpServletResponse response) throws IOException {
        if ("/".equals(request.getPathInfo())
                && "".equals(request.getServletPath())
                && !request.getRequestURI().endsWith("/")) {
            /*
             * Path info is for the root but request URI doesn't end with a
             * slash -> redirect to the same URI but with an ending slash.
             */
            String location = request.getRequestURI() + "/";
            String queryString = request.getQueryString();
            if (queryString != null) {
                location += '?' + queryString;
            }
            response.sendRedirect(location);
            return true;
        } else {
            return false;
        }
    }

request.getPathInfo() is null => “/”.equals(request.getPathInfo() returned

false


request.getServletPath() == “” => “”.equals(request.getServletPath() returned

true


!request.getRequestURI().endsWith(“/”) => returned

true

With this the / is not added at the end of requestURI

I hope it will help

I think the code that creates the relative path to vaadin folder needs a bit more work…
Not sure this is exactly the same problem but still similar…
Adding more slashes at the end of the path also produces the same error…

These examples work just fine
http://localhost/MyApp/ → vaadin will use ./VAADIN/* as path…
http://localhost/MyApp/MySpecialSubFolder/ → vaadin will use ./…/VAADIN/* as path…

BUT in the case of just adding slashes you get the wrong path to VAADIN and

http://localhost/MyApp/// → vaadin will still use ./VAADIN/* as path… and this will fail!!

Hi.
I have the same issue with vaadin 7. We are trying to migrate vaadin 6 to vaadin 7 and we’re stuck. I checked that the vaadin-server.jar is part of the war file. i also tried extracting the vaadinBootstrap.js to the WEB-INF/classes/VAADIN folder. Also tried extracting it to /VAADIN folder. Any ideas? I have also tried clearing my browser cache. it didnt work.

thanks for your help!

Re-check your war that vaadin-server.jar indeed is in /WEB-INF/lib. If you extract it, it should be in a /VAADIN folder in the war. If you are using Eclipse, then it should be in WebContent/VAADIN in the project to end up as /VAADIN in the war.

Thanks! I am no longer getting the “failed to load…” error but i am encountering a javascript error that says “‘vaadin’ is undefined”. Any idea what this means? The error says that it’s a syntax error from vaadinBootstrap.js.

The “could not load vaadinBootstrap” error still happens on Mozilla, but does not show up anymore on IE. What i did was i extracted vaadinBootstrap.js to WebContent/VAADIN. I also checked that the vaadin-server.jar is in WEB-INF/lib. Please help!

Hi,

I also have this problem with weblogic 10.3.4.
If I deploy a Vaadin 7 application without putting the ending slash in the URL like:

http://localhost:7001/myVaadinTest

I get the error saying that Vaadin cannot load the bootstrap javascript, it works if I use the URL:

http://localhost:7001/myVaadinTest/

After debugging in the handleContextRootWithoutSlash() method I have this:

in the first case which does not work:
“/”.equals(request.getPathInfo()) => returns false. request.getPathInfo() is null so it does not do the redirect

Thanks,

Thomas

Please
create a ticket
about the problem on WebLogic with the information you gave here.

This might be resolvable with some server settings as well, but I do not know WebLogic.