问题描述
我是Vaadin的新人,我正在尝试用这项技术进行一些测试。我使用Tomcat 7服务器在Eclipse下将我的项目设置为Maven项目。
起初我开始使用Vaadin 7.0.0,一切都正常。现在我将版本从7.0.0更改为7.1.0,因为我喜欢测试推送功能。
与Vaadin 7.0.0一切正常,但由于我更改版本我得到错误:
请求的资源[/VAADIN/widgetsets/com.vaadin.DefaultWidgetSet /com.vaadin.DefaultWidgetSet.nocache.js]没有从文件系统或通过类加载器找到。将widgetset和/或主题JAR添加到您的类路径或将文件添加到WebContent / VAADIN文件夹。
我已经看到DefaultWidget是由Vaadin创建的,但我该怎么做?
除非您将新的客户端组件添加到Vaadin项目中,否则无需编译WidgetSet。但是,Vaadin的默认配置假设您有一个。要超过此错误,只需删除< init-param>
标签中的 widgetset
c> 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>
或者,您可以创建一个 .xml
文件在同一个包(例如 MyWSet.xml
)作为您的UI类,并在您的 web.xml
。
:中的MyWSet.xml
com.example
<?xml version =1.0encoding =UTF-8?>
<!DOCTYPE模块PUBLIC - // Google Inc.//DTD Google Web Toolkit 1.7.0 // ENhttp://google-web-toolkit.googlecode.com/svn/tags/1.7 0.0 /发行源/型芯/ SRC / GWT-module.dtd>
< module>
< inherits name =com.vaadin.DefaultWidgetSet/>
< / module>
正确的 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>
请记住,您不需要 .xml $ c $您的
web.xml
中的c>后缀。最后,运行 mvn vaadin:compile
来编译这个widgetset。
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?
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.
这篇关于Vaadin 7.1.0 - 找不到DefaultWidgetSet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!