Vaadin 前端文件夹无法加载“./frontend/index.html”的内容

问题描述 投票:0回答:3

嗨,我正在关注 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 文件的前端文件夹

我在 demo/frontend/index.html

中有一个前端文件夹

我还在 demo/target/frontend 中看到另一个前端文件夹,但是这个文件夹没有 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 这是浏览器中显示的内容

提前感谢您的帮助。

java vaadin vaadin22
3个回答
0
投票

我遇到了这个错误。我要做的就是检查你的 vaadin 插件依赖关系,我意识到插件导致了这个错误


0
投票

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

发生了什么 首先,我使用 VSCode、Maven、Java 以及项目的所有依赖项(最新版本)。运行应用程序并访问 localhost:8080 后,我收到以下消息(在浏览器上):“正在构建前端开发包”。这条消息出现了30多分钟。我决定“重新加载项目”。需要注意的是,这可以在 VSCode 中完成,无需任何特定命令,只需单击一下即可。也许有一个 Maven 命令可以做到这一点(mvn clean、mvccompile、mvninstall 或其他) 重新加载后,应用程序似乎运行良好,控制台中没有任何错误消息。当我访问该网页时,它抛出与您几乎相同的错误。我来到终端并开始分析错误行。在某些时候,我发现了一条关键错误消息:无法解析“@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

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

希望这篇文章可以帮助到你。


0
投票

我面临类似的问题,但没有找到任何有用的答案。这应该是 Vaadin 中的基本内容,但令人惊讶的是没有可用的文档。事实上,如果未启用 productionMode,该项目可以从 Netbeans 完美运行,但是当我尝试从浏览器访问 URL 时(该 URL 甚至不引用 index.html),从 IDE 或 Jar 部署启用 productionMode 就会开始给出 index.html 错误

© www.soinside.com 2019 - 2024. All rights reserved.