Hello. Please help me to fix my mini-project.
It must start embedded Jetty server, connect Vaadin servlet and process HTTP-requests over it.
Project created by Vaadin example and was modified for Jetty embedded support.
When i start project it shows that requests are operates over MyUI (shows in console), but there is no UI in browser page.
In browser debug panel i was found that string:
“\n\tCould not navigate to ‘’\n\t\x3Cp>Reason: Couldn’t find route for ‘’\x3C/p>\n\t\x3Cp>\x3C/p>\x3Cdiv>Available routes:\x3C/div>\n\t\x3Cp>\x3C/p>\n\t\x3Cul>\n\t\t\n\t\x3C/ul>\n\t\x3Cp>This detailed message is only shown when running in development mode.\x3C/p>\n”
If i start Maven “package” then there is no new files generated in /target/classes folder and no /VAADIN folder created. Is it normal?
How to get files that must be generated on Maven “package”?
I think I have a similar question/problem trying to rewrite a Vaadin 8 application for Vaadin 11. The Vaadin 8 version programatically launches an embedded Jetty server and it would be helpful to see a Jetty example that works for 11.
I am also desperate looking for a working example of how to get Vaadin 12 to work with embedded Jetty. It used to work with Vaadin 7 and 8, but I can not get it right with Vaadin 12.
Once you get yours working, would you be so kind to post the full example including the relative locations of the resources/jars that are needed?
I think the Vaadin docs (book of Vaadin, etc) should have a section explaining how to get Vaadin Flow working with embedded Jetty. It seems like it is an important topic for enough people.
Basically, you have to configure the server as follows:
public class Application {
public static void main(String... args) throws Exception {
new Application().run(8080, "/");
}
public void run(int port, String contextPath) throws Exception {
URL webRootLocation = this.getClass().getResource("/META-INF/resources/");
URI webRootUri = webRootLocation.toURI();
WebAppContext context = new WebAppContext();
context.setBaseResource(Resource.newResource(webRootUri));
context.setContextPath(contextPath);
context.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", ".*");
context.setConfigurationDiscovered(true);
context.setConfigurations(new Configuration[]{
new AnnotationConfiguration(),
new WebInfConfiguration(),
new WebXmlConfiguration(),
new MetaInfConfiguration(),
new FragmentConfiguration(),
new EnvConfiguration(),
new PlusConfiguration(),
new JettyWebXmlConfiguration()
});
context.getServletContext().setExtendedListenerTypes(true);
context.addEventListener(new ServletContextListeners());
Server server = new Server(port);
server.setHandler(context);
server.start();
server.join();
}
}
Also, you need to use the maven-shade-plugin to package the artifact in an uber-jar.