When I restart tomcat (version 7) and removing temp and work files the result is that it is reading
VAADIN/ directory under
/myapp/VAADIN/
When I stop tomcat, delete temp and work + my application from webapp and redeploy it again through Liferay deployment cycle it is working again and reading
VAADIN/ files under
/html/VAADIN/
Feels like magic, but these are computers and they do not do it. So what is happening?
I don’t really understand what you describe as the problem. Does the browser make requests to an incorrect URL? Or how does the myapp/VAADIN path get used?
This could be an issue with the system you use to deploy the application, or maybe you are sometimes connecting to a servlet running on the same tomcat instance (does your application also have a web.xml?) The latter would at least explain such symptoms. Note that many project creation templates for Liferay include both *portlet.xml and web.xml for ease of testing.
The client gets the directory to use in the configuration on the bootstrap (loader) page or page fragment it gets from the server.
Knowing the Vaadin version in use would also be useful.
See AbstractApplicationPortlet and especially the method getStaticFilesLocation(…). A portal level parameter is used (“vaadin.resources.path”), a default value for which should be present in the portal configuration for recent Liferay versions (found in portal.properties inside WEB-INF/lib/portal-impl.jar). You can also set/override it in your portal-ext.properties file. If the parameter is not present in any of the configuration files, “/html” is used as the default resource path.
As noted earlier, the server sends this information to the client upon the first page load (portlet HTML fragment load to be more accurate), and the client uses the value it received in the first request. It should not get overridden except upon page reload, and normally the same value should be returned again.