在我的构建包中:
plugins {
kotlin("jvm") version "1.3.20"
id ("com.github.johnrengelman.shadow") version "4.0.3"
id ("com.devsoap.vaadin-flow") version "1.0"
id ("org.gretty") version "2.3.1"
}
val kotlinVersion = "1.3.20"
val jettyVersion = "9.4.14.v20181114"
val vaadinVersion = "12.0.4"
我有一个Vaadin项目,并由Gradle进行构建。 我通过pluggin shadowjar创建jar。 这是成功的构建项目。
在deploy文件夹中,我有:
folder: frontend
file: myproject.jar
file: logback.xml
要从控制台启动项目,请使用命令:
java -Dlogback.configurationFile=logback.xml -jar myproject.jar
好。开始成功了。
2019-03-13 10:36:35,747 3844 [main] INFO o.e.jetty.server.AbstractConnector - Started ServerConnector@22a79b2f{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2019-03-13 10:36:35,747 3844 [main] INFO org.eclipse.jetty.server.Server - Started @4034ms
我成功打开了网页。
但是我需要设置生产模式。因此,我这样运行我的项目:
java -Dvaadin.productionMode=true -Dlogback.configurationFile=logback.xml -jar myproject.jar
它开始成功。但是当我尝试打开网页时出现错误:
2019-03-13 10:37:29,610 8468 [qtp495792375-15] WARN o.e.j.s.handler.ContextHandler.ROOT - 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.HandlerList.handle(HandlerList.java:61)
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(Unknown Source)
2019-03-13 10:37:29,613 8471 [qtp495792375-15] WARN o.eclipse.jetty.server.HttpChannel - /booking-v2
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.servlet.ServletHolder.initServlet(ServletHolder.java:693)
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.HandlerList.handle(HandlerList.java:61)
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(Unknown Source)
Caused by: 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)
... 27 common frames omitted