【问题标题】:Vaadin frontend folder Failed to load content of './frontend/index.html'Vaadin 前端文件夹无法加载 \'./frontend/index.html\' 的内容
【发布时间】:2022-11-22 06:23:56
【问题描述】:

嗨,我正在关注 this 这个来自 vaadin chanel 的 Alejandro Duarte 教程,但是在第三个视频中,当我运行我的代码时,我在访问 http://localhost:8080 时遇到了这个错误


java.io.UncheckedIOException: java.io.IOException: Failed to load content of './frontend/index.html'. It is required to have './frontend/index.html' file when using client side bootstrapping.
    at com.vaadin.flow.server.communication.IndexHtmlRequestHandler$IndexHtmlHolder.<init>(IndexHtmlRequestHandler.java:317) ~[flow-server-9.0.1.jar:9.0.1]
    at com.vaadin.flow.server.communication.IndexHtmlRequestHandler$IndexHtmlHolder.<init>(IndexHtmlRequestHandler.java:309) ~[flow-server-9.0.1.jar:9.0.1]
    at com.vaadin.flow.server.communication.IndexHtmlRequestHandler.lambda$getCachedIndexHtmlDocument$0(IndexHtmlRequestHandler.java:261) ~[flow-server-9.0.1.jar:9.0.1]
    at com.vaadin.flow.server.VaadinServletContext.getAttribute(VaadinServletContext.java:73) ~[flow-server-9.0.1.jar:9.0.1]
    at com.vaadin.flow.server.communication.IndexHtmlRequestHandler.getCachedIndexHtmlDocument(IndexHtmlRequestHandler.java:260) ~[flow-server-9.0.1.jar:9.0.1]
    at com.vaadin.flow.server.communication.IndexHtmlRequestHandler.synchronizedHandleRequest(IndexHtmlRequestHandler.java:81) ~[flow-server-9.0.1.jar:9.0.1]
    at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) ~[flow-server-9.0.1.jar:9.0.1]
    at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1567) ~[flow-server-9.0.1.jar:9.0.1]
    at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:299) ~[flow-server-9.0.1.jar:9.0.1]
    at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:109) ~[vaadin-spring-19.0.2.jar:na]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.55.jar:4.0.FR]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:711) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:353) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:313) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.springframework.web.servlet.mvc.ServletForwardingController.handleRequestInternal(ServletForwardingController.java:141) ~[spring-webmvc-5.3.13.jar:5.3.13]
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177) ~[spring-webmvc-5.3.13.jar:5.3.13]
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:51) ~[spring-webmvc-5.3.13.jar:5.3.13]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067) ~[spring-webmvc-5.3.13.jar:5.3.13]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.13.jar:5.3.13]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.13.jar:5.3.13]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.13.jar:5.3.13]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:655) ~[tomcat-embed-core-9.0.55.jar:4.0.FR]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.13.jar:5.3.13]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.55.jar:4.0.FR]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:219) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:213) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:117) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.13.jar:5.3.13]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.13.jar:5.3.13]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.13.jar:5.3.13]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) ~[spring-security-web-5.6.0.jar:5.6.0]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.13.jar:5.3.13]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.13.jar:5.3.13]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.13.jar:5.3.13]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.13.jar:5.3.13]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.13.jar:5.3.13]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.13.jar:5.3.13]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.13.jar:5.3.13]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.13.jar:5.3.13]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.55.jar:9.0.55]
    at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]


我正在检查这条线

java.io.UncheckedIOException: java.io.IOException: Failed to load content of './frontend/index.html'. It is required to have './frontend/index.html' file when using client side bootstrapping.

似乎我没有包含 index.html 文件的前端文件夹

我有一个前端文件夹演示/前端/index.html

我还看到另一个前端文件夹演示/目标/前端但是这个没有 index.html 文件

我怎样才能解决这个问题?

这是我的 pom 文件

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.1</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>demo</description>
    <properties>
        <java.version>17</java.version>
        <vaadin.version>22.0.1</vaadin.version>
    </properties>
    <repositories>
        <repository>
            <id>vaadin-addons</id>
            <url>https://maven.vaadin.com/vaadin-addons</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.vaadin.crudui</groupId>
            <artifactId>crudui</artifactId>
            <version>5.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>collaboration-engine</artifactId>
            <version>3.2.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.mariadb.jdbc</groupId>
            <artifactId>mariadb-java-client</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <version>${vaadin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>production</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-maven-plugin</artifactId>
                        <version>${vaadin.version}</version>
                        <executions>
                            <execution>
                                <id>frontend</id>
                                <phase>compile</phase>
                                <goals>
                                        <goal>prepare-frontend</goal>
                                        <goal>build-frontend</goal>
                                </goals>
                                <configuration>
                                    <productionMode>true</productionMode>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>


这是我用mvn spring-boot:run运行它时的显示方式

------------------ Frontend compilation failed. ------------------

2021-12-11 11:54:37.579  INFO 39073 --- [onPool-worker-1] c.v.b.devserver.AbstractDevServerRunner  : Started Webpack. Time: 6075ms
2021-12-11 11:54:37.602  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : ERROR in target/flow-frontend/VaadinDevmodeGizmo.ts:1034:28
2021-12-11 11:54:37.602  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : TS2571: Object is of type 'unknown'.
2021-12-11 11:54:37.602  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     1032 |       json = JSON.parse(msg.data);
2021-12-11 11:54:37.602  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     1033 |     } catch (e) {
2021-12-11 11:54:37.602  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :   > 1034 |       this.handleError(`[${e.name}: ${e.message}`);
2021-12-11 11:54:37.602  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :          |                            ^
2021-12-11 11:54:37.603  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     1035 |       return;
2021-12-11 11:54:37.603  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     1036 |     }
2021-12-11 11:54:37.603  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     1037 |     const command = json.command;
2021-12-11 11:54:37.603  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :
2021-12-11 11:54:37.626  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : ERROR in target/flow-frontend/VaadinDevmodeGizmo.ts:1034:39
2021-12-11 11:54:37.627  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : TS2571: Object is of type 'unknown'.
2021-12-11 11:54:37.627  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     1032 |       json = JSON.parse(msg.data);
2021-12-11 11:54:37.627  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     1033 |     } catch (e) {
2021-12-11 11:54:37.627  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :   > 1034 |       this.handleError(`[${e.name}: ${e.message}`);
2021-12-11 11:54:37.627  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :          |                                       ^
2021-12-11 11:54:37.627  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     1035 |       return;
2021-12-11 11:54:37.627  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     1036 |     }
2021-12-11 11:54:37.627  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :     1037 |     const command = json.command;
2021-12-11 11:54:37.628  INFO 39073 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :
2021-12-11 12:02:46.371  INFO 39073 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-12-11 12:02:46.372  INFO 39073 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2021-12-11 12:02:46.383  INFO 39073 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 11 ms
2021-12-11 12:02:46.461  INFO 39073 --- [nio-8080-exec-1] c.vaadin.flow.spring.SpringInstantiator  : The number of beans implementing 'I18NProvider' is 0. Cannot use Spring beans for I18N, falling back to the default behavior

https://ibb.co/TvsBRxK 这是它在浏览器中显示的内容

在此先感谢您的帮助。

【问题讨论】:

  • 您可以尝试使用 mvn spring-boot:run 运行它吗
  • 如果您要学习 Alejandro 的示例,我建议您也像他一样使用 Vaadin 21。 Vaadin 22 是全新的,可能与示例和使用的组件不同。
  • 我会用它,它会让你知道一切如何
  • 解决了!感谢@SimonMartinelli 和 Avec,我必须使用 mvn spring-boot:run 运行它并使用相同的 vaadin 版本。

标签: java vaadin vaadin22


【解决方案1】:

我有这个错误。我必须做的是检查你的 vaadin 插件依赖项,我意识到插件导致了这个错误

【讨论】:

    【解决方案2】:

    我有一个类似的问题。我认为一定有更具体的错误,所以我建议你进一步查看你的日志。我将解释我收到的错误以及我做了什么。希望这可以帮到你。顺便说一句,当我因为网站未加载而卡住时,我正在看同一个视频。

    发生了什么 首先,我正在使用 VSCode、Maven、Java 和项目的所有依赖项(最新版本)。运行应用程序并访问 localhost:8080 后,我收到以下消息(在浏览器上):“构建前端开发包”。这条消息在那里停留了 30 多分钟。我决定“重新加载项目”。需要注意的是,这可以在 VSCode 中完成,无需任何特定命令,只需单击一下即可。也许有一个 maven 命令可以做到这一点(mvn clean、mvc compile、mvn install 或其他) 重新加载后,应用程序似乎运行正常,控制台中没有任何错误消息。当我访问该网页时,它抛出与您几乎相同的错误。我去了终端并开始分析错误行。在某个时候,我发现了一条关键错误消息:无法解析“@vaadin/vaadin-grid/theme/lumo/vaadin-grid-styles.js”。 应用程序的构建在根文件夹中为节点创建了一个文件夹:node_modules。在此文件夹中,我找到了消息指示的路径,但没有找到文件。 所以我在网上搜索了一些线索。然后,我决定去 Vaadin() 的 Github 存储库尝试查找该文件。它不在那里,但他们有 HTML 文件。然后我决定将同名的 HTML 文件内容与文件夹中已有的其他 JS 进行比较(我使用 vaadin-grid-pro-styles.js 作为基准)。当我确定一个模式时,我只是使用 Github 存储库中的文件“vaadin-grid-styles.html”创建了所需的文件 (vaadin-grid-styles.js)。瞧,现在一切正常。

    以下是我访问的链接:

    vaadin-grid-styles.html

    vaadin-grid-pro-styles.html

    在构建过程中查找第一个 WARN 或 ERROR 消息。差点忘了,我的 POM.XML 几乎和你的一样。我认为唯一的区别是我使用的版本和特定于我的环境的数据(路径、项目名称、Java 版本等)。

    希望这篇文章能帮到你。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-10-06
      • 2010-11-10
      • 2018-10-16
      • 1970-01-01
      • 2016-08-29
      • 1970-01-01
      • 2020-10-22
      相关资源
      最近更新 更多