I'm trying to run my first application in Vaadin with Maven in Eclipse. So I created new Maven Project (archetype: vaadin-archetype-application) and I'm trying to run it using Tomcat7.
and I get this error:
INFO: Requested resource [/VAADIN/widgetsets/pl.lajtovo.myproj.MyAppWidgetset/pl.app.myproj.MyAppWidgetset.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 found a website with similar problem click, but I don't have in files which were generated a "web.xml".
What did I do wrong?
It's complaining that it's not able to find a compiled widgetset. Vaadin uses GWT on its client side. GWT makes possible to write client-side code with Java but browsers don't understand Java, so that GWT Java code must be compiled to Javascript so that browsers are able to execute it.
To compile the widgetset of your project, you can just say mvn clean install
on the root directory of your project.
If you don't use any addons containing client-side GWT code nor you don't have your own GWT code on your project, then you could just use the standard precompiled com.vaadin.DefaultWidgetSet
. Default widgetset is a precompiled widgetset that contains all core Vaadin components.
In order to use com.vaadin.DefaultWidgetSet
(and avoid widgetset compilation) you need to do the following on a project that's generated from the vaadin-archetype-application
archetype:
Define that you want to use default widgetset by removing the Widgetset
annotation from your UI
:
@Widgetset("com.example.MyAppWidgetset")
public class MyUI extends UI {
Add a dependency to vaadin-client-compiled
, which contains a compiled com.vaadin.DefaultWidgetSet
.
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
</dependency>
Remove MyAppWidgetset.gwt.xml
from your project.