gpt4 book ai didi

spring - Vaadin Spring Projekt 期望无参数构造函数,仅在 tomcat 而不是本地

转载 作者:行者123 更新时间:2023-11-28 23:13:15 26 4
gpt4 key购买 nike

我正在尝试在 Ubuntu 18.04 服务器上的 Tomcat 应用程序服务器上使用 Spring Boot 运行 Vaadin 项目。

我下载了 Vaadin Flow Spring Starter Projekt:https://vaadin.com/start/latest/project-base-spring

但是当我将它部署到tomcat 上并尝试打开它时,出现了这个错误:

There was an exception while trying to navigate to '' with the exception message 'Unable to create an instance of 'de.web.michail.spring.MainView'. Make sure the class has a public no-arg constructor.'
java.lang.IllegalArgumentException: Unable to create an instance of 'de.web.michail.spring.MainView'. Make sure the class has a public no-arg constructor.
at com.vaadin.flow.internal.ReflectTools.createProxyInstance(ReflectTools.java:515)
at com.vaadin.flow.internal.ReflectTools.createInstance(ReflectTools.java:447)
at com.vaadin.flow.di.DefaultInstantiator.getOrCreate(DefaultInstantiator.java:65)
at com.vaadin.flow.di.Instantiator.createRouteTarget(Instantiator.java:158)
at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.lambda$getRouteTarget$1(AbstractNavigationStateRenderer.java:116)
at java.base/java.util.Optional.orElseGet(Optional.java:358)
at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.getRouteTarget(AbstractNavigationStateRenderer.java:115)
at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.handle(AbstractNavigationStateRenderer.java:167)
at com.vaadin.flow.router.Router.handleNavigation(Router.java:221)
at com.vaadin.flow.router.Router.navigate(Router.java:192)
at com.vaadin.flow.router.Router.initializeUI(Router.java:95)
at com.vaadin.flow.server.BootstrapHandler.createAndInitUI(BootstrapHandler.java:1117)
at com.vaadin.flow.server.BootstrapHandler.synchronizedHandleRequest(BootstrapHandler.java:396)
at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1533)
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:227)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417)
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)

我不明白为什么这个基础示例项目没有运行。你认为tomcat是问题所在吗?也许像 WildFly 这样的其他应用程序服务器可以正常运行?

最佳答案

让应用程序扩展 SpringBootServletInitializer 解决问题。

public class Application extends SpringBootServletInitializer {
// ...
}

关于spring - Vaadin Spring Projekt 期望无参数构造函数,仅在 tomcat 而不是本地,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54226981/

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