Vaadin 7.1.0 - DefaultWidgetSet can't be found

北慕城南 提交于 2019-12-13 04:23:42

问题


I am new to Vaadin and I am trying to do some Tests with this technology. I Set up my project as a Maven Project under Eclipse with a Tomcat 7 Server.

At first I started with Vaadin 7.0.0 and everything works fine. Now I change the Version from 7.0.0 to 7.1.0 because I like to test the push functionality. With Vaadin 7.0.0 everything works fine, but since I changed the Version I get the error:

Requested resource [/VAADIN/widgetsets/com.vaadin.DefaultWidgetSet   /com.vaadin.DefaultWidgetSet.nocache.js] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.

I've read that the DefaultWidget is created by Vaadin but how can I do that?


回答1:


Unless you add new client-side components to a Vaadin project, you don't need to compile a WidgetSet. However, the default configuration of Vaadin assumes that you have one. To get past this error simply remove the <init-param> tag for the widgetset in your web.xml.

<servlet>
    <servlet-name>Your-SERVLET-NAME</servlet-name>
    <servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
    <init-param>
        <param-name>UI</param-name>
        <param-value>com.example.MyUI</param-value>
    </init-param>
    <init-param>
        <param-name>widgetset</param-name>
        <param-value>another.path</param-value>
    </init-param>
</servlet>

Alternatively, you can create an .xml file in the same package (e.g. MyWSet.xml) as your UI class, and reference it in your web.xml.

MyWSet.xml in com.example package:

<?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" />
</module>

The right web.xml:

<servlet>
    <servlet-name>Your-SERVLET-NAME</servlet-name>
    <servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
    <init-param>
        <param-name>UI</param-name>
        <param-value>com.example.MyUI</param-value>
    </init-param>
    <init-param>
        <param-name>widgetset</param-name>
        <param-value>com.example.MyWSet</param-value>
    </init-param>
</servlet>

Remember, you don't need the .xml suffix in your web.xml. Finally, run mvn vaadin:compile to compile this widgetset.




回答2:


Adding vaadin-client-compiled worked for me as mentioned in https://vaadin.com/forum/thread/2485026/2496683

<dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiled</artifactId>
        </dependency>


来源:https://stackoverflow.com/questions/17649317/vaadin-7-1-0-defaultwidgetset-cant-be-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!