【发布时间】:2022-01-04 17:37:10
【问题描述】:
我将使用 v18.0.2 的现有(并且正在运行!)Vaadin 应用程序升级到 v21.0.4。使用那个新版本,服务器端应用程序像往常一样启动,它初始化 OK 并且第一个请求触发前端编译(这似乎也可以正常工作,至少日志显示没有异常或错误),但 UI 只是挂起并失败加载(页面顶部有一个细的蓝色进度条,它很快达到大约 50% 的宽度,然后它变得越来越慢,然后在大约 90% 的屏幕宽度处饿死)。
我完全不知道应该朝哪个方向检查或分析。任何建议或暗示这里可能有什么问题都将受到高度赞赏!
如果我应该附上任何配置或日志详细信息来帮助分析,请告诉我!
后来的附录:
我在这里附上我的vaadin_dance.cmd:
@echo off
:package_entries
set fn=package.json
echo Step 1: Going to remove unsupported Vaadin v19+ entries from %fn%:
pause
rem let user see what we do:
@echo on
type %fn% | findstr /V /C:"@vaadin/application-theme-plugin" > %fn%_1
type %fn%_1 | findstr /V /C:"@vaadin/stats-plugin" > %fn%_2
type %fn%_2 | findstr /V /C:"@vaadin/theme-live-reload-plugin" > %fn%_3
type %fn%_3 | findstr /V /C:"@vaadin/theme-loader" > %fn%_4
rem remove an already existing backup - just in case (if there were one the cp below won't work)
rm %fn%~
rem rename back to original and keep a backup:
cp -b -f %fn%_4 %fn%
rem delete the temp. files":
rm %fn%_?
@echo off
echo unsupported Vaadin v19+ entries removed from %fn%
:local_stuff
echo Step 2: Going to remove project local stuff:
pause
rem let user see what we do:
@echo on
rmdir /S /Q .\target
rmdir /S /Q .\node_modules
rmdir /S /Q .\frontend\generated
rm package.json
rm package-lock.json
rm pnpm-lock.yaml
rm pnpmfile.js
rm tsconfig.json
rm types.d.ts
rm webpack.config.js
rm webpack.generated.js
@echo off
echo project local vaadin-generated stuff removed.
:global_stuff
echo Step 3: Going to remove global stuff: removing pnpm stuff
pause
rem let user see what we do:
@echo on
rm -r -f %USERPROFILE%\.pnpm-debug.log
rm -r -f %USERPROFILE%\.pnpm-state.json
rmdir /S /Q %USERPROFILE%\.vaadin
rmdir /S /Q %USERPROFILE%\.pnpm-store
rem just in case - I encountered them here, too:
rmdir /S /Q D:\.pnpm-store
rmdir /S /Q U:\.pnpm-store
@echo off
echo global vaadin-installed stuff removed.
rem clear (and preload) default repository:
:repo_stuff
echo Step 4: Going to empty m2repository!
pause
rem let user see what we do:
@echo on
rem strange enough I again and again got "access denied" on certain .jars ||-( So we first take ownership...
takeown /R /F %USERPROFILE%\.m2\m2repository
rem ... before removing the stuff:
rm -r -f %USERPROFILE%\.m2\m2repository\*
@echo off
echo m2repository cleaned.
echo.
pause
上述 .cmd 文件的过程是这样的,我运行第一步 1,然后停止它并尝试重建 v(在不同的 cmd 窗口中)。如果这不起作用,我从开始重新启动它并运行步骤 1 和 2,然后我停止并尝试重建等。最多在步骤 1、2、3 和 4 之后,我(至少到目前为止)总是能够重建并执行我的应用程序。至少在使用 v18.0.3 构建或恢复到 v18.0.3 时是这样。到目前为止,我还没有成功使用 v21.x。 :-(
带有控制台输出的第二个附录:
应用程序启动正常(即没有任何错误消息(直到我看到“Tomcat 已在端口上启动:...”)
此时,我将浏览器定向到触发 DispatcherServlet 调度的端口。该页面永远不会加载并且浏览器超时,但是没有错误消息或任何提示重新。控制台上问题的类型或原因:
...
2021-12-17 19:36:03,459 INFO [main] org.springframework.boot.web.embedded.tomcat.TomcatWebServer: Tomcat started on port(s): 8085 (http) with context path ''
2021-12-17 19:36:23,678 INFO [http-nio-8085-exec-1] org.apache.juli.logging.DirectJDKLog: Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-12-17 19:36:23,682 INFO [http-nio-8085-exec-1] org.springframework.web.servlet.FrameworkServlet: Initializing Servlet 'dispatcherServlet'
2021-12-17 19:36:23,689 INFO [http-nio-8085-exec-1] org.springframework.web.servlet.FrameworkServlet: Completed initialization in 2 ms
2021-12-17 19:36:26,103 WARN [http-nio-8085-exec-1] org.apache.juli.logging.DirectJDKLog: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [2,172] milliseconds.
2021-12-17 19:36:26,103 WARN [http-nio-8085-exec-3] org.apache.juli.logging.DirectJDKLog: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [1,457] milliseconds.
2021-12-17 19:36:26,179 INFO [http-nio-8085-exec-4] com.vaadin.flow.spring.SpringInstantiator: The number of beans implementing 'I18NProvider' is 0. Cannot use Spring beans for I18N, falling back to the default behavior
<Console output stops here and browser times out>
不幸的是这里似乎没有办法附上截图,所以我不能在这里提供 WebDeveloper 的 Network Tab 输出的输出......
浏览器检查器控制台显示:
Fri Dec 17 2021 19:52:01 GMT+0100 (Central European Standard Time) Atmosphere: unload event vaadinPush-min.js:1:40213
Vaadin push loaded vaadinPush-min.js:1:44231
Failed to register/update a ServiceWorker for scope ‘http://localhost:8085/’: Bad Content-Type of ‘text/html’ received for script ‘sw-runtime-resources-precache.js’. Must be a JavaScript MIME type.
Uncaught (in promise) TypeError: ServiceWorker script at http://localhost:8085/sw.js for scope http://localhost:8085/ threw an exception during script evaluation.
Path '/login' is not properly resolved due to an error. Resolution had failed on route: '(.*)' vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58:17000
Uncaught (in promise) TypeError: class heritage e is not an object or null
to http://localhost:8085/VAADIN/build/vaadin-3-1a44b245d20aa3c33130.cache.js:1
266 http://localhost:8085/VAADIN/build/vaadin-3-1a44b245d20aa3c33130.cache.js:765
r http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:1
promise callback*imports http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
flowInit http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
async*get action/< http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
Z http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
__resolveRoute http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
promise callback*__resolveRoute http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
resolveRoute http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
a http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
a http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
promise callback*a http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
resolve http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
promise callback*resolve http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
render http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
__onNavigationEvent http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
setRoutes http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
<anonymous> http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:58
r http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:1
<anonymous> http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:1
<anonymous> http://localhost:8085/VAADIN/build/vaadin-bundle-aec7d8b0cb06e0cbb6bd.cache.js:1
vaadin-3-1a44b245d20aa3c33130.cache.js:1:153
一个非 Vaadin 实习生应该如何解码这些东西并分析这里出了什么问题?
【问题讨论】:
-
哪一方饿死了?服务器还是客户端?日志说什么(服务器或开发工具)?你有服务器端代码,这会导致僵局吗?
-
“饥饿”是指客户端的进度条(页面顶部的蓝线表示页面加载)。服务器端日志没有什么特别之处。第一个请求会触发通常的前端编译,但没有显示错误(我怀疑在此处显示该部分日志是否有很大帮助,或者会有帮助吗?)。回覆。死锁:当然不能排除这一点,但我不这么认为。我的申请中从来没有。而挂起实际上是通过更新 vaadin 版本号和重建来触发的。在那之前它工作得很好,从那以后就不行了。
-
我忘了补充:加载登录页面时已经发生了“饥饿”。几乎就像 UI 服务器没有在监听一样。
-
你可以试试“mvn vaadin:clean-frontend”然后再试一次吗?
-
您是否尝试仅删除
node_modules文件夹?vaadin:clean-frontend与 mavis 博客文章中的 vaadin dance 相同,但对用户更改的破坏性较小,但有时无法清理 node_modules。