运行 Vaadin Flow beverage-starter-flow with standalone jetty 不工作
Running Vaadin Flow beverage-starter-flow with standalone jetty does not work
用 mvn jetty:run
启动 beverage-starter-flow 然后就可以正常工作了。但是,如果下载相同版本的 Jetty (9.4.11.v20180605) 并通过 IntelliJ IDEA 启动它,则会出现以下错误。
如何解决这个问题? skeleton-starter-flow 应该与独立的 Jetty 一起工作吗?
here was an exception while trying to navigate to '' with the exception message 'Unable to create an instance of 'com.vaadin.starter.beveragebuddy.ui.views.reviewslist.ReviewsList'. The constructor threw an exception.'
java.lang.IllegalArgumentException: Unable to create an instance of 'com.vaadin.starter.beveragebuddy.ui.views.reviewslist.ReviewsList'. The constructor threw an exception.
at com.vaadin.flow.internal.ReflectTools.createProxyInstance(ReflectTools.java:512)
at com.vaadin.flow.internal.ReflectTools.createInstance(ReflectTools.java:449)
at com.vaadin.flow.di.DefaultInstantiator.getOrCreate(DefaultInstantiator.java:64)
at com.vaadin.flow.di.Instantiator.createRouteTarget(Instantiator.java:157)
at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.lambda$getRouteTarget(AbstractNavigationStateRenderer.java:115)
at java.util.Optional.orElseGet(Optional.java:267)
at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.getRouteTarget(AbstractNavigationStateRenderer.java:114)
at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.handle(AbstractNavigationStateRenderer.java:166)
at com.vaadin.flow.router.Router.handleNavigation(Router.java:201)
at com.vaadin.flow.router.Router.navigate(Router.java:172)
at com.vaadin.flow.router.Router.initializeUI(Router.java:93)
at com.vaadin.flow.server.BootstrapHandler.createAndInitUI(BootstrapHandler.java:1050)
at com.vaadin.flow.server.BootstrapHandler.synchronizedHandleRequest(BootstrapHandler.java:393)
at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1493)
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:300)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
...
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedConstructorAccessor19.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45005)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.vaadin.flow.internal.ReflectTools.createProxyInstance(ReflectTools.java:481)
... 51 more
Caused by: java.lang.IllegalStateException: Can't find resource 'frontend://src/views/reviewslist/reviews-list.html' via the servlet context
at com.vaadin.flow.component.polymertemplate.DefaultTemplateParser.getTemplateContent(DefaultTemplateParser.java:104)
at com.vaadin.flow.component.polymertemplate.TemplateDataAnalyzer.parseTemplate(TemplateDataAnalyzer.java:185)
at com.vaadin.flow.component.polymertemplate.TemplateInitializer.<init>(TemplateInitializer.java:93)
at com.vaadin.flow.component.polymertemplate.PolymerTemplate.<init>(PolymerTemplate.java:97)
at com.vaadin.flow.component.polymertemplate.PolymerTemplate.<init>(PolymerTemplate.java:112)
at com.vaadin.starter.beveragebuddy.ui.views.reviewslist.ReviewsList.<init>(ReviewsList.java:74)
... 55 more
运行 来自 IntelliJ 的 Jetty 或 Tomcat 没有将前端文件夹从 webapp 源复制到 target/beveragebuddy-1.0-SNAPSHOT/frontend/
。 运行 mvn package
修复了这个问题。
用 mvn jetty:run
启动 beverage-starter-flow 然后就可以正常工作了。但是,如果下载相同版本的 Jetty (9.4.11.v20180605) 并通过 IntelliJ IDEA 启动它,则会出现以下错误。
如何解决这个问题? skeleton-starter-flow 应该与独立的 Jetty 一起工作吗?
here was an exception while trying to navigate to '' with the exception message 'Unable to create an instance of 'com.vaadin.starter.beveragebuddy.ui.views.reviewslist.ReviewsList'. The constructor threw an exception.'
java.lang.IllegalArgumentException: Unable to create an instance of 'com.vaadin.starter.beveragebuddy.ui.views.reviewslist.ReviewsList'. The constructor threw an exception.
at com.vaadin.flow.internal.ReflectTools.createProxyInstance(ReflectTools.java:512)
at com.vaadin.flow.internal.ReflectTools.createInstance(ReflectTools.java:449)
at com.vaadin.flow.di.DefaultInstantiator.getOrCreate(DefaultInstantiator.java:64)
at com.vaadin.flow.di.Instantiator.createRouteTarget(Instantiator.java:157)
at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.lambda$getRouteTarget(AbstractNavigationStateRenderer.java:115)
at java.util.Optional.orElseGet(Optional.java:267)
at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.getRouteTarget(AbstractNavigationStateRenderer.java:114)
at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.handle(AbstractNavigationStateRenderer.java:166)
at com.vaadin.flow.router.Router.handleNavigation(Router.java:201)
at com.vaadin.flow.router.Router.navigate(Router.java:172)
at com.vaadin.flow.router.Router.initializeUI(Router.java:93)
at com.vaadin.flow.server.BootstrapHandler.createAndInitUI(BootstrapHandler.java:1050)
at com.vaadin.flow.server.BootstrapHandler.synchronizedHandleRequest(BootstrapHandler.java:393)
at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1493)
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:300)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
...
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedConstructorAccessor19.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45005)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.vaadin.flow.internal.ReflectTools.createProxyInstance(ReflectTools.java:481)
... 51 more
Caused by: java.lang.IllegalStateException: Can't find resource 'frontend://src/views/reviewslist/reviews-list.html' via the servlet context
at com.vaadin.flow.component.polymertemplate.DefaultTemplateParser.getTemplateContent(DefaultTemplateParser.java:104)
at com.vaadin.flow.component.polymertemplate.TemplateDataAnalyzer.parseTemplate(TemplateDataAnalyzer.java:185)
at com.vaadin.flow.component.polymertemplate.TemplateInitializer.<init>(TemplateInitializer.java:93)
at com.vaadin.flow.component.polymertemplate.PolymerTemplate.<init>(PolymerTemplate.java:97)
at com.vaadin.flow.component.polymertemplate.PolymerTemplate.<init>(PolymerTemplate.java:112)
at com.vaadin.starter.beveragebuddy.ui.views.reviewslist.ReviewsList.<init>(ReviewsList.java:74)
... 55 more
运行 来自 IntelliJ 的 Jetty 或 Tomcat 没有将前端文件夹从 webapp 源复制到 target/beveragebuddy-1.0-SNAPSHOT/frontend/
。 运行 mvn package
修复了这个问题。