使用独立码头运行Vaadin Flow饮料-起动机流不起作用

时间:2018-07-10 11:54:03

标签: vaadin vaadin10 vaadin-flow

使用mvn jetty:run启动beverage-starter-flow,然后一切正常。但是如果下载相同版本的Jetty(9.4.11.v20180605)并通过IntelliJ IDEA启动它,则会出现以下错误。

如何解决此问题?骨架启动程序流应该与独立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$1(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

1 个答案:

答案 0 :(得分:2)

运行IntelliJ的Jetty或Tomcat并未将前端文件夹从Web应用程序源复制到target/beveragebuddy-1.0-SNAPSHOT/frontend/。运行mvn package可以解决此问题。