Vaadin 12.0.4 Maven 3 +
我从Vaadin的官方网站下载了一个简单的项目 https://vaadin.com/start/latest/simple-ui
在我的Vaadin Maven和Jetty项目中。
在我的pom.xml中
<profiles>
<profile>
<!-- Production mode can be activated with either property or profile -->
<id>production-mode</id>
<activation>
<property>
<name>vaadin.productionMode</name>
</property>
</activation>
<properties>
<vaadin.productionMode>true</vaadin.productionMode>
</properties>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-server-production-mode</artifactId>
</dependency>
</dependencies>
成功构建并以 DEBUG 模式启动。 很好。
但是我想以生产模式启动项目。
我从命令行开始:
mvn jetty:run -Pproduction-mode
或类似这样:
mvn jetty:run -Pproduction-mode -Dvaadin.productionMode=true
项目成功开始。
但是当我尝试打开网页(localhost:8080
)时,我得到了
错误:
[WARNING] unavailable
java.lang.IllegalArgumentException: Failed to find the bundle manifest file 'frontend://vaadin-flow-bundle-manifest.json' in the servlet context for 'ES6' browsers. If you are running a dev-mode servlet container in maven e.g. `jetty:run` change it to `jetty:run-exploded`. If you are not compiling frontend resources, include the 'vaadin-maven-plugin' in your build script. Otherwise, you can skip this error either by disabling production mode, or by setting the servlet parameter 'original.frontend.resources=true'.
at com.vaadin.flow.server.startup.BundleFilterFactory.readBundleManifest(BundleFilterFactory.java:89)
at com.vaadin.flow.server.startup.BundleFilterFactory.createBundleFilterForBrowser(BundleFilterFactory.java:79)
at com.vaadin.flow.server.startup.BundleFilterFactory.createFilters(BundleFilterFactory.java:70)
at com.vaadin.flow.server.VaadinService.init(VaadinService.java:275)
at com.vaadin.flow.server.VaadinServlet.createServletService(VaadinServlet.java:201)
at com.vaadin.flow.server.VaadinServlet.createServletService(VaadinServlet.java:182)
at com.vaadin.flow.server.VaadinServlet.init(VaadinServlet.java:72)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:672)
at org.eclipse.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:521)
at org.eclipse.jetty.servlet.ServletHolder.prepare(ServletHolder.java:805)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:537)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:502)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.lang.Thread.run(Thread.java:748)
[WARNING] /sw.js
[WARNING] /
javax.servlet.ServletException: javax.servlet.ServletException: com.vaadin.flow.server.startup.ServletDeployer@a1f5568f==com.vaadin.flow.server.VaadinServlet,jsp=null,order=-1,inst=false,async=true
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
答案 0 :(得分:1)
类似错误消息,它说:“如果您正在maven中运行开发模式的servlet容器,例如将jetty:run
更改为jetty:run-exploded
。”
必须使用jetty:run-exploded
的原因是生产构建输出文件放置在/target
内部的适当位置,而jetty:run
仅在/src/main/webapp
中查找静态资源。