问题
I was able to integrate a Vaadin module into our Spring based application. After integration I wanted to run a demo of gantt-charts which is an add-on for Vaadin and found it on github here. Inside the folder, there is a demo project. All is fine, except I am having a problem with widgetsets.
Screenshot of the problem :
Also I get a non-serializable error :
Nov 18, 2015 3:16:48 PM org.apache.catalina.session.StandardManager startInternal
SEVERE: Exception loading sessions from persistent storage
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.journaldev.spring.Vaadin.Util$5
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1355)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2000)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1924)
UI code :
@Theme("demo")
@SpringUI
@SuppressWarnings("serial")
public class MyVaadinUI extends UI {
@WebServlet(value = "/testvaadin", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MyVaadinUI.class, widgetset = "org.tltv.gantt.demo.DemoWidgetSet")
public static class Servlet extends SpringVaadinServlet {
}
// Code for gaant-chart taken from demo, code too big and not important //for error
// Pastebin link : http://pastebin.com/mi1ZhH30
}
POM.xml :
vaadin-addons http://maven.vaadin.com/vaadin-addons
<!--- Vaadin dependency -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>org.tltv.gantt</groupId>
<artifactId>gantt-addon</artifactId>
<version>0.9.0</version>
</dependency>
web.xml :
<servlet-mapping>
<servlet-name>vaadin-spring</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>cometd</servlet-name>
<servlet-class>org.cometd.server.CometDServlet</servlet-class>
<init-param>
<param-name>timeout</param-name>
<param-value>300000</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
<async-supported>true</async-supported>
</servlet>
What am I doing wrong? Kindly let me know. Thanks a lot. :-)
回答1:
Try to run mvn clean install to compile the widgetset. If you don't want to use command line, right click in your proyect, Run As > Maven install.
You can also compile your widgetset in eclipse. Open your widgetset file and click in the "gear" symbol in the eclipse menu.
回答2:
You need the vaadin client-compiler to be able to compile your widgetset. Add the following to your pom.xml
:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
And run mvn vaadin:compile
to compile your client-side widgetset.
EDIT: Also have a file called com.journaldev.demoset.gwt.xml
in your build path:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module>
<inherits name="com.vaadin.DefaultWidgetSet" />
<add-linker name="xsiframe" />
<inherits name="org.tltv.gantt.WidgetSet" />
</module>
and change your annotated servlet to read the widgetset from that file.
@WebServlet(value = "/testvaadin", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MyVaadinUI.class, widgetset = "com.journaldev.demoset")
public static class Servlet extends SpringVaadinServlet {
}
With that, you are defining your own widgetset which includes the one defined in the gantt chart project.
来源:https://stackoverflow.com/questions/33783130/vaadin-widget-set-is-not-getting-loaded