Reputation: 9262
I have created a vaadin web application using maven in eclipse
. In particular I have used the archetype vaadin-archetype-touchkit
as described in the book of vaadin (20.3.4). Without making any change on the default generated code I have run it with maven with goals clean package
. Then I compiled the Widgetset
. When I try to run it on Tomcat 7, I receive the strange message from the webpage:
Failed to load the WidgetSet:
<WidgetSet Path>.DefaultWidgetSet.nocache.js
On the console I see also the error messages:
INFO: Requested resource [/VAADIN/themes/reindeer/styles.css] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
INFO: 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.
INFO: Requested resource [/VAADIN/themes/reindeer/styles.css] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
It has struck me maven has not created a web.xml
file, although I have read in the tutorial that it is no more necessary in vaadin 7
. I have read the similar question where it is proposed that an adjustment in web.xml
file should be done. Should I infer that I have also to create a web.xml
file manually?
I find strange as well, that when I tried the same procedure with the archetype for a typical vaadin 7 application, it runs properly. Since I have to develop a touchkit-application I would appreciate any suggestion-idea abut what could be missing on my original attempt.
Upvotes: 3
Views: 16119
Reputation: 11
here is the readme in the root of the project
To compile the entire project, run "mvn install". To run the application, run "mvn jetty:run" and open http://localhost:8080/ .
To develop the theme, simply update the relevant theme files and reload the application. Pre-compiling a theme eliminates automatic theme updates at runtime - see below for more information.
Debugging client side code - run "mvn vaadin:run-codeserver" on a separate console while the application is running - activate Super Dev Mode in the debug window of the application
To produce a deployable production mode WAR: - change productionMode to true in the servlet class configuration (nested in the UI class) - run "mvn clean vaadin:compile-theme package" - See below for more information. Running "mvn clean" removes the pre-compiled theme. - test with "mvn jetty:run-war
follow the instruction and you will get the correct page : )
Upvotes: 0
Reputation: 7351
For me, adding the following to pom.xml
helped:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>${vaadin.version}</version>
</dependency>
Upvotes: 3
Reputation: 1217
The web.xml is no longer needed only if you use servlet 3.0 configuration (annotating your servlet as described 4.8.3. WEB Servlet Class)
Usually you'd configure your Vaadin 3.0 Servlet Config in this way:
public class MyUI extends UI {
@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MyUI.class)
public static class Servlet extends VaadinServlet {
}
@Override
protected void init(VaadinRequest request) {
//your init stuff here
}
}
Where using the @VaadinServletConfiguration as shortcut for setting vaadin-related params.
Now, if you have no vaadin addon in your project (so you're using the default widgetset), that's it, no more work is required.
Instead, if you're using custom addons, you must specify which widgetset to use in the @VaadinServletConfiguration
simply by adding the widgetset parameter in this way
public class MyUI extends UI {
@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(widgetset="com.bla.bla.MyWidgetSet",productionMode = false, ui = MyUI.class)
public static class Servlet extends VaadinServlet {
}
@Override
protected void init(VaadinRequest request) {
//your init stuff here
}
}
Otherwise you must create the web.xml manually as usual...
When it comes to maven, I think you've just to run mvn clean package and on the package phase the maven-vaadin-plugin will compile you're widgetset automatically.
Upvotes: 4