After Migration from 6.8 to 7.2.3 "xxx" when calling the Servlets

Our Vaadin Project running latest Vaadin 6.8 up to now. I tried migrating it to Vaadin 7.2.3 which so far went withour major Problems. Code is error-clean now, Widgetset has been fixed to Vaadin 7 aswell.

But when i try to call of the three Servlets we defined i always get:

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

Error in Firebug:

“NetworkError: 404 ProxyServlet: /VAADIN/vaadinBootstrap.js - http://localhost:8080/VAADIN/vaadinBootstrap.js

I tried various things i found on the internetz, but i couldn’t get the application to run.

The Application is run under OSGI, most probably built upon this code/framework: https://github.com/njbartlett/VaadinOSGi

The web.xml reads like:

<?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>SmartAppWidgetset</display-name>
    <context-param>
        <description>Vaadin production mode</description>
        <param-name>productionMode</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
      <param-name>heartbeatInterval</param-name>
      <param-value>300</param-value>
    </context-param>
    <context-param>
        <param-name>disable-xsrf-protection</param-name>
        <param-value>true</param-value>
    </context-param>    
    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
    <servlet>
        <servlet-name>SmartAppServlet</servlet-name>
         <servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
        <init-param>
            <description>SmartApp UI</description>
            <param-name>UI</param-name>
            <param-value>de.schletter.vaadin.smartapp.SmartApp</param-value>
        </init-param>
        <init-param>
            <description>SmartApp UI Provider</description>
            <param-name>UIProvider</param-name>
            <param-value>de.schletter.vaadin.smartapp.SmartAppUIProvider</param-value>
        </init-param>        
        <init-param>
            <description>smartapp widgetset</description>
            <param-name>widgetset</param-name>
            <param-value>de.schletter.vaadin.widgetset.SmartPVChargeWidgetset</param-value>
        </init-param>
        <init-param>
            <param-name>closeIdleSessions</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>pushmode</param-name>
            <param-value>automatic</param-value>
        </init-param>    
    </servlet>
    <servlet-mapping>
        <servlet-name>SmartAppServlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>SmartAppServlet</servlet-name>
        <url-pattern>/VAADIN/*</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>

Component.xml reads like:

<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" enabled="true" immediate="true" name="SmartAppUI">
   <implementation class="de.schletter.vaadin.smartapp.SmartAppFactory"/>
   <service>
      <provide interface="com.vaadin.utils.vaadinbridge.ApplicationFactory"/>
   </service>
   <property name="alias" type="String" value=""/>
   <reference bind="setUserManager" cardinality="1..1" interface="at.anext.os.services.UserManager" name="UserManager" policy="static" unbind="unsetUserManager"/>
   <reference bind="setEnergyManagementServer" cardinality="1..1" interface="at.anext.nrg.core.api.EnergyManagementServer" name="EnergyManagementServer" policy="static" unbind="unsetEnergyManagementServer"/>
   <reference bind="setTreeManager" cardinality="1..1" interface="at.anext.os.services.TreeManager" name="TreeManager" policy="static" unbind="unsetTreeManager"/>
   <reference bind="setTransportManager" cardinality="1..1" interface="at.anext.os.services.TransportManager" name="TransportManager" policy="static" unbind="unsetTransportManager"/>/>
</scr:component>

The Servlet reads like:

@VaadinServletConfiguration(productionMode = false, ui = SmartApp.class, widgetset="de.schletter.vaadin.smartapp.widgetset.SmartAppWidgetset")
public class SmartAppServlet extends ApplicationFactoryServlet {

    private static final long serialVersionUID = 1695033090125424008L;

    public SmartAppUIProvider smartappuiprovider;
    
    protected SmartAppServlet(ApplicationFactory pApplicationFactory) {
        super(pApplicationFactory);
    }
    
    @Override
    public void servletInitialized() throws ServletException {
        super.servletInitialized();
        
        System.out.println("getService().getBaseDirectory(): " + getService().getBaseDirectory());
        
        getService().addSessionInitListener(new SessionInitListener() {
            private static final long serialVersionUID = 8400616501276407235L;

            @Override
            public void sessionInit(SessionInitEvent pSessionInitEvent)    throws ServiceException {
                smartappuiprovider = new SmartAppUIProvider();
                pSessionInitEvent.getSession().addUIProvider(smartappuiprovider);
            }
        });
    }    
}

The UIProvider reads like:

public class SmartAppUIProvider extends UIProvider {
    
    private static final long serialVersionUID = -2670416570266790494L;
    
    private String currentTheme = "smartapp";

    @Override
    public Class<? extends UI> getUIClass(UIClassSelectionEvent pUIClassSelectionEvent) {
        System.out.println("getRequest(): " + pUIClassSelectionEvent.getRequest());
/*        
        if (event.getRequest().getHeader("user-agent").contains("mobile")) {
            return TouchUI.class;
        } else {
            return DefaultUI.class;
        }
*/                
        return SmartApp.class;
    }

    public void setTheme(String pTheme) {
        currentTheme = pTheme;
    }

    @Override
    public String getTheme(UICreateEvent pUICreateEvent) {
        VaadinRequest tVaadinRequest = pUICreateEvent.getRequest();
        VaadinServletRequest tVaadinServletRequest = (VaadinServletRequest) tVaadinRequest;
        
        HttpServletRequest tHttpServletRequest = tVaadinServletRequest.getHttpServletRequest();
        System.out.println("getServletPath: " + tHttpServletRequest.getServletPath());
        
        return currentTheme;
    }
    
    @Override
    public String getWidgetset(UICreateEvent pUICreateEvent) {
        System.out.println("pUICreateEvent.getRequest(): " + pUICreateEvent.getRequest());
        System.out.println("pUICreateEvent.getService(): " + pUICreateEvent.getService());
        System.out.println("pUICreateEvent.getSource(): " + pUICreateEvent.getSource());
        System.out.println("pUICreateEvent.getUIClass(): " + pUICreateEvent.getUIClass());
        System.out.println("pUICreateEvent.getUiId(): " + pUICreateEvent.getUiId());
       
        return "de.schletter.vaadin.smartapp.widgetset.SmartAppWidgetset";
    }
}

Some part of the console log reads like:

[code]
WARNUNG:

Vaadin is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
To show debug window, add ?debug to your application URL.

BundleContentHttpContext - getResource - pName: /
BundleContentHttpContext - getResource - tURL: bundleresource://920.fwk1576330609/
getService().getBaseDirectory():
20140704 12:36:35.725 INFO class de.schletter.vaadin.smartapp.SmartAppFactory.smartapp - *******************************************************************
20140704 12:36:35.725 INFO class de.schletter.vaadin.smartapp.SmartAppFactory.smartapp - ****** S t a r t A p p l i c a t i o n ****
20140704 12:36:35.725 INFO class de.schletter.vaadin.smartapp.SmartAppFactory.smartapp - *******************************************************************
pServiceReference: {com.vaadin.utils.vaadinbridge.ApplicationFactory}={alias=, component.name=SmartAppUI, component.id=88, service.id=203}
tAliasObject:
tBundleContentHttpContext: com.vaadin.utils.vaadinbridge.internal.BundleContentHttpContext@51733a5
context: org.eclipse.osgi.framework.internal.core.BundleContextImpl@2da04643
tService: de.schletter.vaadin.smartapp.SmartAppFactory@363f983f
tApplicationFactory: de.schletter.vaadin.smartapp.SmartAppFactory@363f983f
04.07.2014 12:36:35 com.vaadin.server.DefaultDeploymentConfiguration checkProductionMode
[/code]So vaadin should be running with 7.2.3 and also the vaadin-server.jar should be visible for the Jetty Webserver.
I tried high and lo so far, but nothing worked. I have the strange feeling it’s just a minor thing i need to change… Have i missed something?!

I tried debugging, but my skills are limited so i got stuck helplessly. Meh…

Any tipps and tricks? Any more information needed? I really need to get this migration going, so any valuable help would be very much appreciated…

Updated to Vaadin 7.2.4, but the error still shows up.

The webpage Vaadin created reads like:

<!DOCTYPE html>
<html>
 <head>
  <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/smartapp/favicon.ico" />
  <link rel="icon" type="image/vnd.microsoft.icon" href="./VAADIN/themes/smartapp/favicon.ico" />
 </head>
 <body scroll="auto" class=" v-generated-body">
  <div id="ROOT-2521314" class=" v-app smartapp">
   <div class=" v-app-loading"></div>
   <noscript>
    You have to enable javascript in your browser to use an application built with Vaadin.
   </noscript>
  </div>
  <iframe tabindex="-1" id="__gwt_historyFrame" style="position:absolute;width:0;height:0;border:0;overflow:hidden" src="javascript:false"></iframe>
  <script type="text/javascript" src="./VAADIN/vaadinBootstrap.js"></script>
  <script type="text/javascript">//<![CDATA[
if (!window.vaadin) alert("Failed to load the bootstrap javascript: .\/VAADIN\/vaadinBootstrap.js");
if (typeof window.__gwtStatsEvent != 'function') {
vaadin.gwtStatsEvents = [];
window.__gwtStatsEvent = function(event) {vaadin.gwtStatsEvents.push(event); return true;};
}
vaadin.initApplication("ROOT-2521314",{
    "heartbeatInterval": 300,
    "versionInfo": {
        "vaadinVersion": "7.2.4"
    },
    "vaadinDir": ".\/VAADIN\/",
    "authErrMsg": {
        "message": "Take note of any unsaved data, and <u>click here<\/u> or press ESC to continue.",
        "caption": "BÄM - authentication error"
    },
    "widgetset": "de.schletter.vaadin.smartapp.widgetset.SmartAppWidgetset",
    "theme": "smartapp",
    "debug": true,
    "comErrMsg": {
        "message": "Take note of any unsaved data, and <u>click here<\/u> or press ESC to continue.",
        "caption": "BÄM - communication error"
    },
    "serviceUrl": ".",
    "standalone": true,
    "sessExpMsg": {
        "message": "Take note of any unsaved data, and <u>click here<\/u> or press ESC key to continue.",
        "caption": "BÄM - session expired"
    }
});
//]]></script>
 </body>
</html>

Markus-

What version of Jetty are you using? When I upgraded to 7.2.x from 7.1 I had to upgrade my jetty version because I had 404 errors with my project when I upgraded Vaadin. I am using Embedded Jetty and I am currently using 9.2. They changed around the Jetty API a little so it is not as easy as just upgrading the version…you will have to do a little tweeking to get it working again. Their web site now has some good examples of different web server flavors.

Best Regards,
Eric

Hello Eric, thanks for your reply. We’re currently on Jetty 6.1 so can’t say if this is an issue?

Regarding to the Vaadin Prerequisites Jetty 5-9 should be okay…?!

Markus-

All I can say is that it took me a while to get things back on track with my project when upgrading to 7.2. I ended up having a version confliction from what Vaadin has packaged for jetty and what my project was using. I ended up excluding all of jetty (I don’t know if it included everything, but I excluded everything that I could think of) from the vaadin-client-compiler and then things started to work.

I just excluded the jetty components in Ivy

[code]















[/code]Anyways, I hope all works out for you and your project.

Best Regards,
Eric

We don’t use Ivy or Maven here plus i sadly don’t have access to the Jetty-Plugin/Feature as some collegue implemented that. Maybe when i finally get the Jetty8 thing i can give a better/working result…

But it pretty much can be that Vaadin compiles and uses some way newer version of jetty or such… As the Application just gets the compiled widgetset data that’s pretty strange what’s going on there…

Tried removing those Jetty-JARs from the web-inf, but after i compiling and copying the generated files i still get that darn bootstrap-error. Sigh…

Back to the drawing board. But thanks for die info anyway!

Rather than excluding individual Jetty JARs, you should probably configure your deployment settings so that the Ivy configuration “widgetset-compile” is not deployed on the server. If using Eclipse, see “Deployment Assembly” (if I remember the name correctly) in project properties as well as build path and export settings for the project.