How to identify root cause for missing nochache.js

Hi,

I have an issue with widget set resources (Requested resource […nochache.js]
not found…)

Where can i find documented how the resource path is built?

Fragments of the pat contains literal sections that can be traced to the application.

Some facts:

  • clean installation of Vaadin(Maven) 7.7.3
  • sources copied from working 7.7.1 non-maven based application
  • cleaned
  • theme & widgets compiled

The missing resource has the following path that don’t exist in class path:
INFO: Requested resource
[/VAADIN/widgetsets/.widgetset.Widgetset/.widgetset.Widgetset.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.

So, from where are these names fetched?
Where/how am i supposed to find the resource?


In 7.7.x the name is coming from a generated Java class called AppWidgetset in target/generated-sources/wscdn

EDIT: this is only for widgetset mode fetch or cdn.

I have a target\generated-resources\gwt\AppWidgetset.gwt (an xml-file)

What i want to understand is how the eco-system for vaadin/javascript/maven/eclipse/… so i and others may identify the possible root causes for the nocache.js message. All i find here is basic stuff like recompiling and ensuring prescence of certain files.

In my case i get a fresh collection of java script files and others in target\classes\VAADIN\widgetsets\AppWidgetset\ folder and despite that the application fails on a nocache.js exception.

I can only se a black-box with 5 surfaces:

  • Compile command
  • AppWidgetset.gwt
  • target\classes\VAADIN\widgetsets\AppWidgetset\ structure
  • logfile
  • error message (nocache.js)

So, where is the documentation how they are interconnected?
In my case the (virtual) path required by the application can’t be found so the question is: what causes the missmatch?

  • Wrong path in application?
  • Faulty compiled widget set?
  • If the application expected path is wrong, how is it constructed? From what parts in the application? What should it look like.
  • Is the class resolution faulty?

I have searched the documentation and looked at quite a few forum posts to no vail.

I assume that i have done something stupid but it may help with documentation and/or better coordination between compiling/using/validating the vaadin mechanisms and rules regarding the java script implementation.

The following is valid for Vaadin 7.7.x.

  1. Widgetset is needed for every Vaadin application and needs to be compiled
    1.1) If you are using only core Vaadin components you are effectively using pre-compiled DefaultWidgetset from vaadin-client-compiled.jar

  2. Vaadin Maven plugin is used for compiling widgetset and it can be in three modes: local, fetch, or cdn. Local mode means locally compiled (or precompiled from jar) and served by your app server. Fetch means compiled in the cloud and downloaded in compile time and served by your app server. CDN means compiled in the cloud and served from the cloud to browser. Path of the widgetset in local mode is /VAADIN/widgetsets/AppWidgetset/AppWidgetset.nocache.js, fetch mode is /VAADIN/widgetsets/somehashcode/somehashcode.nocache.js and in cdn mode https://ws.vaadin.com/somerandomhash/somerandomhash.nocache.js

  3. If you use any addons having their custom widgetset you need to include those to your application widgetset defined in module xml file (local mode) or AppWidgetset class (fetch and cdn mode). Vaadin does this automatically for you and generates the necessary files and calls the widgetset either AppWidgetset in local mode or some calculated hash in fetch/cdn mode.

  4. If you have local client-side code you need to be compiled to your widgetset. You override the automatic behavior by making your own widgset module file MyCustomWhatEverWidgetset.gwt.xml. If your UI is in the same Maven module as your custom code, you need to put Widgetset(“MyCustomWhatEverWidgetset”) annotation in your UI class. Path of the widgetset js file is /VAADIN/widgetsets/the.package.name.of.xml.file.MyCustomWhatEverWidgetset.nocache.js.

I hope this clarified something. Ask more details if you need.

And to clarify. I didn’t check Vaadin sources or anything like that, this was only observed behavior running build with different settings. I also used this blog post for guidance
https://vaadin.com/blog/-/blogs/demystifying-widget-set-cloud-compilation

Maybe someone more familiar with then inside of the Vaadin compiler can correct me if I’m wrong.

Hi, found the root cause to my issue.

I had 2 @VaadinServletConfiguration specification in my extended UI class.
Unfortunately at opposite parts of the source file:

  1. at UI class level (correct specification)
  2. at servlet class level containing a widgetset=“” specification (probably a test leftofter way back)

Since it works (widget compilation) in 7.7.1 and not in 7.7.3 the handling order of the @VaadinServletConfiguration must have changed.