0

I'm trying to create a Vaadin application to deploy on a tomcat server following the beginner's guide in the book of Vaadin. https://vaadin.com/book/-/page/getting-started.maven.html I used the Maven command line provided at this address. I can successfully create a Maven project, build it with mvn package and import it in eclipse. Once done, I can add it to my tomcat server and run it. When trying to connect to localhost http://localhost:8080/viznet/ (viznet being the project name) I get a this error : Requested resource [/VAADIN/widgetsets/viznet.MyAppWidgetset/viznet.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 would like to know a) why is this happening b) How can I solve it.

I did a lot of researches yet, found some alike problems but couldn't fix mine. It seems to me I can't get my project to use the default widget (or fix this particular one but the default widget would suit me just fine). There might be some error in my configuration or missing information here, I'm brand new to this so I don't know what you need to know in order to help me.

Environment: Ubuntu 14.04 Eclipse 4.1 Maven Latest Tomcat 8.0

Thanks in advance

LionelM
  • 15
  • 5

2 Answers2

2

I fixed this problem by creating new Maven configuration and adding "package jetty:run" in command line, then just run your project, it should work fine, after this you can use Tomcat again!

henorek
  • 472
  • 5
  • 19
  • It does work on jetty but I cannot go back to tomcat. Since it's not a problem for me to swap, I'll just do it, and upvote you. Thanks – LionelM Nov 14 '15 at 00:43
0

You need to compile your widgetset using mvn vaadin:compile. Look at this question.

Community
  • 1
  • 1
Abbas
  • 3,228
  • 1
  • 23
  • 27
  • I encountered this in my initial research (trying not to repost) but a) I don't find the proper web.xml b) It doesn't contain the line the answer speaks of so I couldn't use it to solve my problem. Thank you anyway – LionelM Nov 14 '15 at 00:39
  • @LionelM did you try to run mvn vaadin:compile command? I think that the generated project uses annotations instead of web.xml, just take a look at the class that extends UI in your project. Also just running mvn install should compile the widgetset for you. – Henri Kerola Nov 14 '15 at 02:50
  • I tried mvn install and got a successful build with it but it didn't change anything. Same with compile. I found the annotation you're speaking of but I'm not sure it was there before jetty fixed the problem. Tomcat definitely won't get my app to work but, since jetty does, I assume I did something wrong installing / configuring tomcat (the web.xml file is a tomcat component if I understood well ?). I stuggled to understand how did my tool integrate and work together so it must be my bad. – LionelM Nov 15 '15 at 10:46
  • You can either have a `web.xml` or [annotation on your UI class](https://vaadin.com/book/-/page/application.environment.html) to handle initial settings for your Vaadin servlet. You need `mvn vaadin:compile` to [compile](https://vaadin.com/book/-/page/addons.maven.html) Vaadin client-side (widgetset). When you do so, a bunch of `js` files will be created in your project, e.g. `src/main/webapp/VAADIN/widgetsets/viznet.MyAppWidgetset/viznet.MyAppWidgetset.nocache.js`. Please note that `mvn install` or `mvn jetty:run` has no effect on these `js` files. – Abbas Nov 15 '15 at 20:07