1

使用then启动drink-starter-flowmvn jetty:run就可以了。但是,如果下载相同版本的 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
4

1 回答 1

2

从 IntelliJ 运行 Jetty 或 Tomcat 不会将前端文件夹从 webapp 源复制到target/beveragebuddy-1.0-SNAPSHOT/frontend/. 运行mvn package解决了这个问题。

于 2018-07-11T07:42:40.663 回答