Joseph92
(Joseph Higgs)
January 23, 2020, 8:58pm
1
I’ve had this issue with Vaadin since I started working with it (version 14).
When I compile to jar using embedded tomcat, it always works fine.
When I then compile to war and put on a tomcat server, it fails more often than not. Failure is 404, “The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.”
I will then futz around with things, delete target, node_modules, .json files, .js files, .M2 directory; run mvn clean install, maybe twice; run npm install; light 3-5 candles; run mvn clean package -Pproduction. Put that war file on a tomcat server and it will generally fail again.
Do this a random number of times and it will finally work. Oh, and restart both Apache and Tomcat occasionally just for spice.
Driving me crazy …
Mehdi37
(Mehdi Javan)
January 24, 2020, 8:34am
2
Hi Joseph,
It works for me with changing the packaging
to war
and mvn clean package
. Can you help us reproduce this issue? What other info can you share with us about your project? Based on your question, I concluded that you’re talking about a Spring application. Right? What exact version of Vaadin are you using? Can you share your pom.xml
?
Joseph92
(Joseph Higgs)
January 24, 2020, 11:44am
3
Really appreciate the response. Yes, it is Vaadin and Spring Boot.
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.hpi</groupId>
<artifactId>hpitpc</artifactId>
<version>1</version>
<name>TPC</name>
<packaging>war</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
<vaadin.version>14.1.5</vaadin.version>
</properties>
<repositories>
<!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->
<!-- Main Maven repository -->
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<!-- Repository used by many Vaadin add-ons: https://vaadin.com/directory -->
<repository>
<id>Vaadin Directory</id>
<url>https://maven.vaadin.com/vaadin-addons</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<type>pom</type>
<scope>import</scope>
<version>${vaadin.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.18</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.2.3.RELEASE</version>
</dependency><dependency>
<groupId>com.vaadin</groupId>
<!-- Replace artifactId with vaadin-core to use only free components -->
<artifactId>vaadin-core</artifactId>
<exclusions>
<!-- Webjars are only needed when running in Vaadin 13 compatibility mode -->
<exclusion>
<groupId>com.vaadin.webjar</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.insites</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.polymer</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.polymerelements</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.vaadin</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.webcomponents</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency><!-- Added to provide logging output as Flow uses -->
<!-- the unbound SLF4J no-operation (NOP) logger implementation -->
<!--<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>2.2.2.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>2.2.2.RELEASE</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.vaadin</groupId>
<artifactId>date-time-fields</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.6.SEC03</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<defaultGoal>jetty:run</defaultGoal>
<plugins>
<!-- We use jetty plugin, replace it with your favourite developing servlet container -->
<!--<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.15.v20190215</version>
<configuration>
<scanIntervalSeconds>1</scanIntervalSeconds>
</configuration>
</plugin>-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.2.RELEASE</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<!--
Take care of synchronizing java dependencies and imports in
package.json and main.js files.
It also creates webpack.config.js if not exists yet.
-->
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>14.1.5</version>
<executions>
<execution>
<goals>
<goal>prepare-frontend</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- Production mode is activated using -Pproduction -->
<id>production</id>
<properties>
<vaadin.productionMode>true</vaadin.productionMode>
</properties>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-server-production-mode</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>build-frontend</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
mvn clean package -Pproduction output
[INFO]
Scanning for projects...
[INFO]
[INFO]
---------------------------< com.hpi:hpitpc >---------------------------
[INFO]
Building TPC 1
[INFO]
--------------------------------[ war ]
---------------------------------
Downloading from Vaadin Directory: https://maven.vaadin.com/vaadin-addons/org/webjars/npm/mobile-drag-drop/maven-metadata.xml
Downloading from vaadin-prerelease: https://maven.vaadin.com/vaadin-prereleases/org/webjars/npm/mobile-drag-drop/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/webjars/npm/mobile-drag-drop/maven-metadata.xml
Downloading from vaadin-snapshots: https://oss.sonatype.org/content/repositories/vaadin-snapshots/org/webjars/npm/mobile-drag-drop/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/webjars/npm/mobile-drag-drop/maven-metadata.xml (425 B at 1.1 kB/s)
Downloading from vaadin-prereleases: https://maven.vaadin.com/vaadin-prereleases/org/webjars/npm/mobile-drag-drop/maven-metadata.xml
Downloading from vaadin-addons: https://maven.vaadin.com/vaadin-addons/org/webjars/npm/mobile-drag-drop/maven-metadata.xml
[INFO]
[INFO]
--- maven-clean-plugin:2.5:clean (default-clean) @ hpitpc ---
[INFO]
Deleting /home/white/OneDrive/Documents/Dev/hpitpc/target
[INFO]
[INFO]
--- maven-resources-plugin:2.6:resources (default-resources) @ hpitpc ---
[INFO]
Using 'UTF-8' encoding to copy filtered resources.
[INFO]
Copying 9 resources
[INFO]
[INFO]
--- maven-compiler-plugin:2.3.2:compile (default-compile) @ hpitpc ---
[INFO]
Compiling 35 source files to /home/white/OneDrive/Documents/Dev/hpitpc/target/classes
[WARNING]
/home/white/OneDrive/Documents/Dev/hpitpc/src/main/java/com/hpi/tpc/ui/views/LogoffView.java:[33,33]
[deprecation]
executeJavaScript(String,Serializable...) in Page has been deprecated
[INFO]
[INFO]
--- vaadin-maven-plugin:14.1.5:prepare-frontend (default) @ hpitpc ---
[INFO]
Updated npm /home/white/OneDrive/Documents/Dev/hpitpc/target/frontend/package.json.
[INFO]
[INFO]
--- vaadin-maven-plugin:14.1.5:build-frontend (default) @ hpitpc ---
[INFO]
Scanning classes to find frontend configurations and dependencies...
[INFO]
Visited 981 classes. Took 1248 ms.
[INFO]
Visited 93 classes. Took 55 ms.
[INFO]
Added 33 dependencies to '/home/white/OneDrive/Documents/Dev/hpitpc/target/frontend/package.json'
[INFO]
Updated npm /home/white/OneDrive/Documents/Dev/hpitpc/target/frontend/package.json.
[INFO]
Skipping `npm install`.
[INFO]
Copying frontend resources from jar files ...
[INFO]
Visited 137 resources. Took 123 ms.
[INFO]
Copying project local frontend resources.
[INFO]
Copying frontend directory completed.
[INFO]
Updated /home/white/OneDrive/Documents/Dev/hpitpc/target/frontend/generated-flow-imports-fallback.js
[INFO]
Updated /home/white/OneDrive/Documents/Dev/hpitpc/target/frontend/generated-flow-imports.js
[INFO]
Running webpack ...
Emitted /home/white/OneDrive/Documents/Dev/hpitpc/target/classes/META-INF/VAADIN/config/stats.json
Hash: 92c93c687490e0d05a62
Version: webpack 4.30.0
Time: 5575ms
Built at: 01/24/2020 5:42:19 AM
Asset Size Chunks Chunk Names
build/vaadin-2-9113c487031b5a139ba9.cache.js 524 KiB 2 [emitted]
build/vaadin-2-9113c487031b5a139ba9.cache.js.gz 118 KiB [emitted]
build/vaadin-3-d79846f486ee090835eb.cache.js 441 KiB 3 [emitted]
build/vaadin-3-d79846f486ee090835eb.cache.js.gz 112 KiB [emitted]
build/vaadin-4-c4060144a9eadf9c10a3.cache.js 3.8 KiB 4 [emitted]
build/vaadin-4-c4060144a9eadf9c10a3.cache.js.gz 1.16 KiB [emitted]
build/vaadin-5-269ab1029ea05576b81c.cache.js 2.35 KiB 5 [emitted]
build/vaadin-5-269ab1029ea05576b81c.cache.js.gz 1010 bytes [emitted]
build/vaadin-bundle-b42311cd75dd88fae23a.cache.js 564 KiB 0 [emitted]
bundle
build/vaadin-bundle-b42311cd75dd88fae23a.cache.js.gz 143 KiB [emitted]
build/vaadin-bundle.es5-eb0ecab87cf1b4499f7a.cache.js 658 KiB 1 [emitted]
bundle.es5
build/vaadin-bundle.es5-eb0ecab87cf1b4499f7a.cache.js.gz 153 KiB [emitted]
build/webcomponentsjs/LICENSE.md 1.52 KiB [emitted]
build/webcomponentsjs/README.md 10.5 KiB [emitted]
build/webcomponentsjs/bundles/webcomponents-ce.js 19.5 KiB [emitted]
build/webcomponentsjs/bundles/webcomponents-ce.js.map 129 KiB [emitted]
build/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js 113 KiB [emitted]
build/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js.map 676 KiB [emitted]
build/webcomponentsjs/bundles/webcomponents-sd-ce.js 85 KiB [emitted]
build/webcomponentsjs/bundles/webcomponents-sd-ce.js.map 549 KiB [emitted]
build/webcomponentsjs/bundles/webcomponents-sd.js 66.4 KiB [emitted]
build/webcomponentsjs/bundles/webcomponents-sd.js.map 420 KiB [emitted]
build/webcomponentsjs/custom-elements-es5-adapter.js 950 bytes [emitted]
build/webcomponentsjs/package.json 2.45 KiB [emitted]
build/webcomponentsjs/src/entrypoints/custom-elements-es5-adapter-index.js 659 bytes [emitted]
build/webcomponentsjs/src/entrypoints/webcomponents-bundle-index.js 1.66 KiB [emitted]
build/webcomponentsjs/src/entrypoints/webcomponents-ce-index.js 675 bytes [emitted]
build/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-index.js 860 bytes [emitted]
build/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-pf-index.js 1.22 KiB [emitted]
build/webcomponentsjs/src/entrypoints/webcomponents-sd-index.js 767 bytes [emitted]
build/webcomponentsjs/webcomponents-bundle.js 114 KiB [emitted]
build/webcomponentsjs/webcomponents-bundle.js.map 678 KiB [emitted]
build/webcomponentsjs/webcomponents-loader.js 6.13 KiB [emitted]
Entrypoint bundle = build/vaadin-bundle-b42311cd75dd88fae23a.cache.js
Entrypoint bundle.es5 = build/vaadin-bundle.es5-eb0ecab87cf1b4499f7a.cache.js
[30]
../node_modules/@polymer/polymer/polymer-legacy.js?babel-target=es6 + 3 modules 28.5 KiB {0} [built]
| 4 modules
[31]
../node_modules/@polymer/polymer/polymer-legacy.js?babel-target=es5 + 3 modules 34 KiB {1} [built]
| 4 modules
[68]
../node_modules/@polymer/polymer/lib/elements/custom-style.js?babel-target=es6 + 1 modules 6.32 KiB {0} [built]
| 2 modules
[69]
../node_modules/@polymer/polymer/lib/elements/custom-style.js?babel-target=es5 + 1 modules 7.5 KiB {1} [built]
| 2 modules
[95]
../node_modules/@vaadin/vaadin-text-field/theme/lumo/vaadin-text-field.js?babel-target=es6 + 1 modules 8.64 KiB {0} [built]
| 2 modules
[96]
../node_modules/@vaadin/vaadin-text-field/theme/lumo/vaadin-text-field.js?babel-target=es5 + 1 modules 17.7 KiB {1} [built]
| 2 modules
[147]
../node_modules/@vaadin/vaadin-item/theme/lumo/vaadin-item.js?babel-target=es6 + 1 modules 2.22 KiB {0} [built]
| 2 modules
[148]
../node_modules/@vaadin/vaadin-item/theme/lumo/vaadin-item.js?babel-target=es5 + 1 modules 2.55 KiB {1} [built]
| 2 modules
[151]
../node_modules/@vaadin/vaadin-text-field/theme/lumo/vaadin-password-field.js?babel-target=es6 + 1 modules 1.05 KiB {0} [built]
| 2 modules
[152]
../node_modules/@vaadin/vaadin-text-field/theme/lumo/vaadin-password-field.js?babel-target=es5 + 1 modules 1.35 KiB {1} [built]
| 2 modules
[185]
../node_modules/@polymer/iron-icon/iron-icon.js?babel-target=es6 + 1 modules 16 KiB {0} [built]
| 2 modules
[215]
../target/frontend/generated-flow-imports.js?babel-target=es5 + 89 modules 562 KiB {1} [built]
| ../target/frontend/generated-flow-imports.js?babel-target=es5 3.03 KiB [built]
| ./styles/shared-styles.js?babel-target=es5 2.96 KiB [built]
| ./src/views/errors/access-denied-view.js?babel-target=es5 1.45 KiB [built]
| + 87 hidden modules
[216]
../target/frontend/generated-flow-imports.js?babel-target=es6 + 88 modules 426 KiB {0} [built]
| ../target/frontend/generated-flow-imports.js?babel-target=es6 3.03 KiB [built]
| ./styles/shared-styles.js?babel-target=es6 2.83 KiB [built]
| ./src/views/errors/access-denied-view.js?babel-target=es6 464 bytes [built]
| + 86 hidden modules
[295]
../target/frontend/generated-flow-imports-fallback.js + 1 modules 5.73 KiB {5} [built]
| ../target/frontend/generated-flow-imports-fallback.js 2.43 KiB [built]
| + 1 hidden module
[296]
../target/frontend/generated-flow-imports-fallback.js + 1 modules 8.33 KiB {4} [built]
| ../target/frontend/generated-flow-imports-fallback.js 2.43 KiB [built]
| + 1 hidden module
+ 282 hidden modules
[INFO]
update-frontend took 10654ms.
[INFO]
[INFO]
--- maven-resources-plugin:2.6:testResources (default-testResources) @ hpitpc ---
[INFO]
Using 'UTF-8' encoding to copy filtered resources.
[INFO]
skip non existing resourceDirectory /home/white/OneDrive/Documents/Dev/hpitpc/src/test/resources
[INFO]
[INFO]
--- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ hpitpc ---
[INFO]
Nothing to compile - all classes are up to date
[INFO]
[INFO]
--- maven-surefire-plugin:2.12.4:test (default-test) @ hpitpc ---
[INFO]
No tests to run.
[INFO]
[INFO]
--- maven-war-plugin:2.2:war (default-war) @ hpitpc ---
[INFO]
Packaging webapp
[INFO]
Assembling webapp [hpitpc]
in
[/home/white/OneDrive/Documents/Dev/hpitpc/target/hpitpc-1]
[INFO]
Processing war project
[INFO]
Copying webapp resources
[/home/white/OneDrive/Documents/Dev/hpitpc/src/main/webapp]
[INFO]
Webapp assembled in [229 msecs]
[INFO]
Building war: /home/white/OneDrive/Documents/Dev/hpitpc/target/hpitpc-1.war
[INFO]
------------------------------------------------------------------------
[INFO]
BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO]
Total time: 23.719 s
[INFO]
Finished at: 2020-01-24T05:42:23-06:00
[INFO]
------------------------------------------------------------------------