vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
620 stars 167 forks source link

Vaadin 14.0.1+Intellij+Tomcat: visited 0 jar files #6288

Open mvysny opened 5 years ago

mvysny commented 5 years ago

Steps to reproduce:

  1. git clone https://github.com/vaadin/skeleton-starter-flow master and make sure Vaadin version in pom.xml is 14.0.1
  2. Create a local Tomcat launch configuration
  3. Launch. The app starts but shows a red Webpack Error popup. The log:
[RMI TCP Connection(2)-127.0.0.1] INFO com.vaadin.flow.server.startup.DevModeInitializer - Starting dev-mode updaters in /home/mavi/work/vaadin/starters-10+/skeleton-starter-flow folder.
[RMI TCP Connection(2)-127.0.0.1] INFO dev-updater - Scanning classes to find frontend configurations and dependencies...
[RMI TCP Connection(2)-127.0.0.1] INFO dev-updater - Visited 657 classes. Took 1524 ms.
[RMI TCP Connection(2)-127.0.0.1] INFO dev-updater - Added "@vaadin/vaadin-core-shrinkwrap": "14.0.1" line.
[RMI TCP Connection(2)-127.0.0.1] INFO dev-updater - Added "@vaadin/vaadin-shrinkwrap": "14.0.1" line.
[RMI TCP Connection(2)-127.0.0.1] INFO dev-updater - Updated npm /home/mavi/work/vaadin/starters-10+/skeleton-starter-flow/target/frontend/package.json.
[RMI TCP Connection(2)-127.0.0.1] INFO dev-updater - Running `npm install` ...
npm WARN npm npm does not support Node.js v10.15.2
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
20-Aug-2019 13:27:39.837 INFO [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/home/mavi/local/apache-tomcat-9.0.20/webapps/manager]
20-Aug-2019 13:27:40.128 INFO [Catalina-utility-2] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
20-Aug-2019 13:27:40.192 INFO [Catalina-utility-2] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/home/mavi/local/apache-tomcat-9.0.20/webapps/manager] has finished in [355] ms

> @vaadin/vaadin-usage-statistics@2.0.4 postinstall /home/mavi/work/vaadin/starters-10+/skeleton-starter-flow/node_modules/@vaadin/vaadin-core-shrinkwrap/node_modules/@vaadin/vaadin-usage-statistics
> node check.js

    Vaadin collects development time usage statistics to improve this product. To opt-out, either run:
    npm explore @vaadin/vaadin-usage-statistics -- npm run disable
    to store disable statistics for the machine, or add
    "vaadin": { "disableUsageStatistics": true }
    to the project package.json and re-run npm install to disable statistics for the project.

    For more details, see https://github.com/vaadin/vaadin-usage-statistics

> @vaadin/vaadin-usage-statistics@2.0.4 postinstall /home/mavi/work/vaadin/starters-10+/skeleton-starter-flow/node_modules/@vaadin/vaadin-shrinkwrap/node_modules/@vaadin/vaadin-usage-statistics
> node check.js

    Vaadin collects development time usage statistics to improve this product. To opt-out, either run:
    npm explore @vaadin/vaadin-usage-statistics -- npm run disable
    to store disable statistics for the machine, or add
    "vaadin": { "disableUsageStatistics": true }
    to the project package.json and re-run npm install to disable statistics for the project.

    For more details, see https://github.com/vaadin/vaadin-usage-statistics

> @vaadin/vaadin-usage-statistics@2.0.8 postinstall /home/mavi/work/vaadin/starters-10+/skeleton-starter-flow/node_modules/@vaadin/vaadin-usage-statistics
> node check.js

    Vaadin collects development time usage statistics to improve this product. To opt-out, either run:
    npm explore @vaadin/vaadin-usage-statistics -- npm run disable
    to store disable statistics for the machine, or add
    "vaadin": { "disableUsageStatistics": true }
    to the project package.json and re-run npm install to disable statistics for the project.

    For more details, see https://github.com/vaadin/vaadin-usage-statistics

> core-js@2.6.9 postinstall /home/mavi/work/vaadin/starters-10+/skeleton-starter-flow/node_modules/core-js
> node scripts/postinstall || echo "ignore"

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN no-name@ No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 887 packages from 394 contributors in 34.631s
[RMI TCP Connection(2)-127.0.0.1] INFO dev-updater - package.json updated and npm dependencies installed. 
[RMI TCP Connection(2)-127.0.0.1] INFO dev-updater - Copying frontend resources from jar files ...
[RMI TCP Connection(2)-127.0.0.1] INFO dev-updater - Visited 0 jar files. Took 2 ms.
[RMI TCP Connection(2)-127.0.0.1] INFO dev-updater - 

  Failed to find the following imports in the `node_modules` tree:
      - @vaadin/flow-frontend/flow-component-renderer.js
  If the build fails, check that npm packages are installed.

  To fix the build remove `node_modules` directory to reset modules.
  In addition you may run `npm install` to fix `node_modules` tree structure.

[RMI TCP Connection(2)-127.0.0.1] INFO dev-updater - No js modules to update
[RMI TCP Connection(2)-127.0.0.1] INFO dev-webpack - Starting webpack-dev-server, port: 38833 dir: /home/mavi/work/vaadin/starters-10+/skeleton-starter-flow
   /usr/bin/node /home/mavi/work/vaadin/starters-10+/skeleton-starter-flow/node_modules/webpack-dev-server/bin/webpack-dev-server.js --config /home/mavi/work/vaadin/starters-10+/skeleton-starter-flow/webpack.config.js --port 38833 -d --inline=false
[webpack] INFO dev-webpack - ℹ 「wds」: Project is running at http://localhost:38833/webpack-dev-server/
[webpack] INFO dev-webpack - ℹ 「wds」: webpack output is served from /
[webpack] INFO dev-webpack - ℹ 「wds」: Content not from webpack is served from /home/mavi/work/vaadin/starters-10+/skeleton-starter-flow/target/classes/META-INF/VAADIN, src/main/webapp
[webpack] INFO dev-webpack -          Serving the 'stats.json' file dynamically.
[webpack] INFO dev-webpack - ✖ 「wdm」: Hash: c005afc0d81e90f6d8f2
[webpack] INFO dev-webpack - Version: webpack 4.30.0
[webpack] INFO dev-webpack - Time: 4049ms
[webpack] INFO dev-webpack - Built at: 08/20/2019 1:28:17 PM
[webpack] INFO dev-webpack -                                                                  Asset       Size      Chunks                    Chunk Names
[webpack] INFO dev-webpack -                      build/vaadin-bundle-0a696e907628830b9cdd.cache.js   1.82 MiB      bundle  [emitted]         bundle
[webpack] INFO dev-webpack -                  build/vaadin-bundle.es5-f5d6953b9b1eec0690a1.cache.js   2.04 MiB  bundle.es5  [emitted]  [big]  bundle.es5
[webpack] INFO dev-webpack -                                       build/webcomponentsjs/LICENSE.md   1.52 KiB              [emitted]         
[webpack] INFO dev-webpack -                                        build/webcomponentsjs/README.md   10.9 KiB              [emitted]         
[webpack] INFO dev-webpack -                      build/webcomponentsjs/bundles/webcomponents-ce.js   16.7 KiB              [emitted]         
[webpack] INFO dev-webpack -                  build/webcomponentsjs/bundles/webcomponents-ce.js.map    112 KiB              [emitted]         
[webpack] INFO dev-webpack -                build/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js    108 KiB              [emitted]         
[webpack] INFO dev-webpack -            build/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js.map    653 KiB              [emitted]         
[webpack] INFO dev-webpack -                   build/webcomponentsjs/bundles/webcomponents-sd-ce.js   80.9 KiB              [emitted]         
[webpack] INFO dev-webpack -               build/webcomponentsjs/bundles/webcomponents-sd-ce.js.map    527 KiB              [emitted]         
[webpack] INFO dev-webpack -                      build/webcomponentsjs/bundles/webcomponents-sd.js   65.1 KiB              [emitted]         
[webpack] INFO dev-webpack -                  build/webcomponentsjs/bundles/webcomponents-sd.js.map    415 KiB              [emitted]         
[webpack] INFO dev-webpack -                   build/webcomponentsjs/custom-elements-es5-adapter.js  924 bytes              [emitted]         
[webpack] INFO dev-webpack - build/webcomponentsjs/entrypoints/custom-elements-es5-adapter-index.js  656 bytes              [emitted]         
[webpack] INFO dev-webpack -        build/webcomponentsjs/entrypoints/webcomponents-bundle-index.js   1.66 KiB              [emitted]         
[webpack] INFO dev-webpack -            build/webcomponentsjs/entrypoints/webcomponents-ce-index.js  672 bytes              [emitted]         
[webpack] INFO dev-webpack -         build/webcomponentsjs/entrypoints/webcomponents-sd-ce-index.js  851 bytes              [emitted]         
[webpack] INFO dev-webpack -      build/webcomponentsjs/entrypoints/webcomponents-sd-ce-pf-index.js   1.19 KiB              [emitted]         
[webpack] INFO dev-webpack -            build/webcomponentsjs/entrypoints/webcomponents-sd-index.js  761 bytes              [emitted]         
[webpack] INFO dev-webpack -                                     build/webcomponentsjs/package.json      3 KiB              [emitted]         
[webpack] INFO dev-webpack -                          build/webcomponentsjs/webcomponents-bundle.js    109 KiB              [emitted]         
[webpack] INFO dev-webpack -                      build/webcomponentsjs/webcomponents-bundle.js.map    655 KiB              [emitted]         
[webpack] INFO dev-webpack -                          build/webcomponentsjs/webcomponents-loader.js   6.13 KiB              [emitted]         
[webpack] INFO dev-webpack - Entrypoint bundle = build/vaadin-bundle-0a696e907628830b9cdd.cache.js
[webpack] INFO dev-webpack - Entrypoint bundle.es5 [big] = build/vaadin-bundle.es5-f5d6953b9b1eec0690a1.cache.js
[webpack] INFO dev-webpack - [../node_modules/@vaadin/vaadin-button/theme/lumo/vaadin-button.js] 72 bytes {bundle.es5} [built]
[webpack] INFO dev-webpack - [../node_modules/@vaadin/vaadin-button/theme/lumo/vaadin-button.js] 72 bytes {bundle} [built]
[webpack] INFO dev-webpack - [../node_modules/@vaadin/vaadin-lumo-styles/color.js] 7.63 KiB {bundle.es5} [built]
[webpack] INFO dev-webpack - [../node_modules/@vaadin/vaadin-lumo-styles/color.js] 7.43 KiB {bundle} [built]
[webpack] INFO dev-webpack - [../node_modules/@vaadin/vaadin-lumo-styles/icons.js] 87 bytes {bundle.es5} [built]
[webpack] INFO dev-webpack - [../node_modules/@vaadin/vaadin-lumo-styles/icons.js] 87 bytes {bundle} [built]
[webpack] INFO dev-webpack - [../node_modules/@vaadin/vaadin-lumo-styles/sizing.js] 679 bytes {bundle.es5} [built]
[webpack] INFO dev-webpack - [../node_modules/@vaadin/vaadin-lumo-styles/sizing.js] 664 bytes {bundle} [built]
[webpack] INFO dev-webpack - [../node_modules/@vaadin/vaadin-lumo-styles/spacing.js] 1.29 KiB {bundle.es5} [built]
[webpack] INFO dev-webpack - [../node_modules/@vaadin/vaadin-lumo-styles/spacing.js] 1.27 KiB {bundle} [built]
[webpack] INFO dev-webpack - [../node_modules/@vaadin/vaadin-lumo-styles/style.js] 1.24 KiB {bundle.es5} [built]
[webpack] INFO dev-webpack - [../node_modules/@vaadin/vaadin-lumo-styles/style.js] 1.23 KiB {bundle} [built]
[webpack] INFO dev-webpack - [../node_modules/@vaadin/vaadin-lumo-styles/typography.js] 3.61 KiB {bundle.es5} [built]
[webpack] INFO dev-webpack - [../target/frontend/generated-flow-imports.js] 770 bytes {bundle.es5} [built]
[webpack] INFO dev-webpack - [../target/frontend/generated-flow-imports.js] 772 bytes {bundle} [built]
[webpack] INFO dev-webpack -     + 171 hidden modules
[webpack] INFO dev-webpack - 
[webpack] ERROR dev-webpack - ERROR in ../target/frontend/generated-flow-imports.js
[webpack] ERROR dev-webpack - Module not found: Error: Can't resolve '@vaadin/flow-frontend/flow-component-renderer.js' in '/home/mavi/work/vaadin/starters-10+/skeleton-starter-flow/target/frontend'
[webpack] ERROR dev-webpack -  @ ../target/frontend/generated-flow-imports.js 12:0-58
[webpack] ERROR dev-webpack - 
[webpack] ERROR dev-webpack - ERROR in ../target/frontend/generated-flow-imports.js
[webpack] ERROR dev-webpack - Module not found: Error: Can't resolve '@vaadin/flow-frontend/flow-component-renderer.js' in '/home/mavi/work/vaadin/starters-10+/skeleton-starter-flow/target/frontend'
[webpack] ERROR dev-webpack -  @ ../target/frontend/generated-flow-imports.js 12:0-58
[webpack] ERROR dev-webpack - ℹ 「wdm」: Failed to compile.
[webpack] ERROR dev-webpack - 
------------------ Frontend compilation failed. -----------------
20-Aug-2019 13:28:17.289 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
[RMI TCP Connection(2)-127.0.0.1] INFO com.vaadin.flow.server.startup.ServletDeployer - Automatically deploying Vaadin servlet with name com.vaadin.flow.server.startup.ServletDeployer to /*
[2019-08-20 01:28:17,464] Artifact project-base:war exploded: Artifact is deployed successfully
[2019-08-20 01:28:17,464] Artifact project-base:war exploded: Deploy took 47,243 milliseconds
[http-nio-8080-exec-1] WARN com.vaadin.flow.server.DefaultDeploymentConfiguration - 
====================================================================
Vaadin is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
====================================================================

Workaround: downgrade to Vaadin 14.0.0. The jar files are now correctly auto-discovered and the app starts:

[RMI TCP Connection(4)-127.0.0.1] INFO dev-updater - Visited 10 jar files. Took 9 ms.
mvysny commented 5 years ago

Screenshot from 2019-08-20 13-30-05

caalador commented 5 years ago

I couldn't reproduce this on a clean base starter + idea + tomcat 9.0.20

[RMI TCP Connection(3)-127.0.0.1] INFO dev-updater - package.json updated and npm dependencies installed. 
[RMI TCP Connection(3)-127.0.0.1] INFO dev-updater - Copying frontend resources from jar files ...
[RMI TCP Connection(3)-127.0.0.1] INFO dev-updater - Visited 10 jar files. Took 182 ms.
[RMI TCP Connection(3)-127.0.0.1] INFO dev-updater - Updated C:\Users\mikae\Code\skeleton-starter-flow\target\frontend\generated-flow-imports.js

What do you have in the local Tomcat launch configuration? Also the only change in 14.0.1 is that we handle correctly paths with special characters like space (%20) in the url names.

Also you seem to be running an older node (even if this doesn't matter for the jar scanning)

npm WARN npm npm does not support Node.js v10.15.2
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
mvysny commented 5 years ago

I am also using Tomcat 9.0.20 :+1:

In my Tomcat Run configuration, in the Deployment tab, I've had the project-base:war exploded artifact. When I replaced it with just project-base:war it indeed started to work. When I reverted back to project-base:war exploded artifact, the server still started but it printed Visited 0 jar files. Took 1 ms.; so when I deleted the node_modules folder and restarted Tomcat, it again failed with Can't resolve '@vaadin/flow-frontend/flow-component-renderer.js'

TL;DR: Vaadin 14.0.1+IDEA+Tomcat combo does not seem to work when you select the 'exploded' artifact, however Vaadin 14.0.0 works properly even with 'exploded' artifact.

caalador commented 5 years ago

I had it working fine with both war and exploded war.

mvysny commented 5 years ago

Hmm, I'm running Linux x86-64 on Java 8, I wonder if it is some kind of Linux issue, or just my local dev env issue... Let me try on a different machine with Linux.

mvysny commented 5 years ago

Actually, on the same machine when the project is located in /home/mavi/temp/skeleton-starter-flow/ then it starts properly; when it's located in /home/mavi/work/vaadin/starters-10+/skeleton-starter-flow/ it doesn't start. I wonder if the + character in the path name could break things...

rokkolesa commented 5 years ago

I have the same problem running on wildfly (tried it on 12.0.0, 15.0.1 and 17.0.1). My steps to reproduce:

After some digging it seems that those JARs that should be visited do not have the compliant path for regex in DevModeInitializer#JAR_FILE_REGEX).

Example: One of the JARs with frontend resources is flow-data-2.0.8.jar. The URLDecoder decodes the path to /C:/path-to-project-source/starter-simple-app/starter-simple-app-ui/target/starter-simple-app-ui-1.0-SNAPSHOT/WEB-INF/lib/flow-data-2.0.8.jar/META-INF/resources/frontend/, which is not compliant with the regex, which says that the path should contain file:/ and .jar.

Even more, if I add another module in a multi-module project to this starter which also has frontend dependencies in src/main/resources/META-INF/resources/frontend, it also does not get scanned.

I actually dug around some and found that the multi-module problem is already handled in #6242 (but sadly it only exists in a feature branch for now, not in master branch). If I download that branch with those fixes and modify the additional regex some more to allow trailing /, everything starts to work as it should.

caalador commented 5 years ago

Wildfly has another problem which is in ticket https://github.com/vaadin/flow/issues/6245 as it uses vfs:/ instead of file:/

denis-anisimov commented 4 years ago

This comment says that home/mavi/temp/skeleton-starter-flow/ path works . Looks like the problem is only with special paths like /home/mavi/work/vaadin/starters-10+/skeleton-starter-flow/.