gpt4 book ai didi

maven - 使用代理存储库时尝试在 Vaadin 14 中运行 "Hello World"时出错

转载 作者:行者123 更新时间:2023-12-04 07:44:18 24 4
gpt4 key购买 nike

enter image description here我从“start.vaadin.com”下载了该项目。然后我做了“mvn install”,一切正常。

当我运行“mvn spring-boot:run”时,它会在尝试编译前端时生成错误:“com.vaadin.flow.server.BootstrapException:无法读取 webpack 统计文件。”

我不使用 Maven Central,而是使用我大学的本地存储库。我的电脑无法访问互联网,只能访问我大学的 Nexus 存储库:“http://nexus.prod.uci.cu/repository/maven-all/”。这个存储库有 maven 和节点(即 npm)服务。但是,如您所见,不存在依赖性问题。 “mvn install”工作正常。我禁用了防火墙。但是,我推断问题出在 Vaadin 尝试编译前端时执行的“npm install”。有可能我的 PC 正在尝试使用来自 Internet 的 Node 存储库而不是我大学的存储库,在这种情况下它不能,因为它没有 Internet 访问权限。我将我的 npm 配置为使用我大学的存储库,但我一直收到此错误。

这是等待大约三分钟后的浏览器输出:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.
Mon Apr 26 17:55:55 GMT-05:00 2021
There was an unexpected error (type=Internal Server Error, status=500).
com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.
com.vaadin.flow.server.ServiceException: com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.
at com.vaadin.flow.server.VaadinService.handleExceptionDuringRequest(VaadinService.java:1596)
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1559)
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:247)
at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:710)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:457)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:352)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at org.springframework.web.servlet.mvc.ServletForwardingController.handleRequestInternal(ServletForwardingController.java:141)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: com.vaadin.flow.server.BootstrapException: Unable to read webpack stats file.
at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.setupFrameworkLibraries(BootstrapHandler.java:894)
at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.setupDocumentHead(BootstrapHandler.java:771)
at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.getBootstrapPage(BootstrapHandler.java:540)
at com.vaadin.flow.server.BootstrapHandler.synchronizedHandleRequest(BootstrapHandler.java:481)
at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1547)
... 52 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.base/java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.base/java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:400)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:243)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:225)
at java.base/java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
at java.base/java.net.Socket.connect(Socket.java:591)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:341)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:362)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1242)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1181)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1075)
at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1009)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1581)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1509)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
at com.vaadin.flow.server.frontend.FrontendUtils.getStatsAssetsByChunkName(FrontendUtils.java:566)
at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.appendNpmBundle(BootstrapHandler.java:910)
at com.vaadin.flow.server.BootstrapHandler$BootstrapPageBuilder.setupFrameworkLibraries(BootstrapHandler.java:892)
... 57 more

pom.xml 与从 Vaadin 站点生成的相同。我已经在 Vaadin 页面上写过。

我用“Hello World in Vaadin”评论了一些发生在我身上的奇怪事情。当我从 Maven 原型(prototype)创建项目时,如下所示:

"mvn -B archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=LATEST -DgroupId=org.test -DartifactId=webapp -Dversion=1.0-SNAPSHOT"

如“https://vaadin.com/learn/tutorials/import-maven-project-eclipse”中所述

这对我不起作用。即使在生产模式下:“mvn jetty:run -Pproduction”。浏览器启动并没有产生错误,但它没有显示“Hello World”应该显示的内容。它显示了一个页面,通知“你离线”,并解释说“我的应用程序需要互联网连接才能工作。你现在似乎无法访问服务器。检查你的互联网连接并尝试重新加载页面以使用应用程序”。附件是我的屏幕图像,浏览器正在运行该应用程序。

为什么这种情况发生在 jetty 而不是 spring-boot 上?

最佳答案

异常(exception)情况似乎是尝试连接到 webpack-dev-server 以从生成的统计信息中获取 Assets 。

要排除包和连接的问题,您可以尝试使用 mvn spring-boot:run -Pproduction 运行生产构建。如果可行,那么至少可以正确下载节点和 Maven 包。

如果生产模式有效,那么在运行开发模式时,日志中可能会出现 Webpack failed with the exception: 这表明 devServer 无法启动以及一些有关原因的信息。

此外,通过将记录器设置为记录调试,您应该获得用于启动 webpack-dev-server 的命令字符串,类似于

[0m2021-04-28 07:25:38.105 DEBUG 60260 --- [         task-2] dev-webpack                              : 
C:\Program Files\nodejs\node.exe \
.\node_modules\webpack-dev-server\bin\webpack-dev-server.js \
--config .\webpack.config.js --port 62103 \
--watchDogPort=62102 -d --inline=false `

在这种情况下,您可以通过转到 localhost:62103 尝试连接到 devServer。这应该会向您显示一个只有 config 文件夹的文件夹结构,但是如果您转到 localhost:62103/stats.json,您应该会收到一个以 开头的 json 文件code>{"hash":"c827122594d41ad4f7df","assetsByChunkName":{"bundle":"build/vaadin-bundle-...

获取调试日志记录的方法是在 application.properties 中添加行 logging.level.root = debug。由于有很多输出,我建议通过管道传输到文件,例如运行 mvn > out.txt 并从文本文件中搜索错误和信息。

希望这有助于找出问题所在。

关于maven - 使用代理存储库时尝试在 Vaadin 14 中运行 "Hello World"时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67274356/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com