В моем проекте Kotlin Jetty я строю Maven.Мне нужно запустить приложение в производственном режиме.(отсюда https://vaadin.com/docs/flow/production/tutorial-production-mode-basic.html) В результате в моем pom.xml
<profiles>
<profile>
<id>production-mode</id>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-server-production-mode</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>copy-production-files</goal>
<goal>package-for-production</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Итак, для запуска в производственном режиме Maven я использую команду:
mvn jetty:run-exploded -Pproduction-mode
и мое веб-приложениезапуск в режиме производства . Отлично.
Но мне также нужно создать исполняемый jar (или war) для запуска моего веб-приложения из консоли. Поэтому в результате я использую плагин maven "maven-shade-plugin
«Поэтому в моем pom.xml я добавляю:
plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.myproject.AppStarterKt</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
и создаю jar в рабочем режиме:
mvn verify -Pproduction-mode
, в результате я получаю автономный (runnable) jar, содержащий все зависимости. Nice.
Но когда я хочу запустить автономную банку в РЕЖИМЕ ПРОИЗВОДСТВА, как это:
java -Dvaadin.productionMode=true -jar myproject-1.0-SNAPSHOT.jar
Но я получаю ошибку:
[qtp1495242910-15] WARN org.eclipse.jetty.server.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)
[qtp1495242910-15] WARN org.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)