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…