Running Vaadin App with other Servlet / Webservices

Hi Vaadin Team

I have a small App, that exposes two Soap Webservices that persist some data via JPA . I try to add a Vaadin UI to manage the content from the database.
But since my Soap Services (Apache CXF) are running my Vaadin UI is not showing up.
As I have done other Vaadin UI’s without such a constellation I know its not a bug of my code. I copied the Vaadin UI from a running app.
My Setup:

  • SprintBoot 2.1.7.Release
  • Java 1.8
  • Apache CXF 3.2.1
  • Vaadin 13.0.11

The two Apache CXF Endpoints are running under:
http://localhost:8080/soap-api/syriusMock/pendenzV1

http://localhost:8080/soap-api/syriusMock/pendenzV2

My Vaadin Main View runs under:
http://localhost:8080/mock

@SuppressWarnings(“serial”)
@Route(“mock”)
@PWA(name = “MockView”, shortName = “Mock”)
@Theme(value = Lumo.class, variant = Lumo.LIGHT)
public class MockMainView extends VerticalLayout {

private VTabSheet sheet = new VTabSheet();

public SyriusMockMainView() {

sheet.addTab(“Auftrag”, new AuftragUploadView());

add(sheet);

setSizeFull();
}
}

Nothing shows up and I get a 404 not found from Tomcat.

I tried to navigate to the vaadinServlet which shows me that the route is available.

Could not navigate to ‘vaadinServlet’

Reason: Couldn’t find route for ‘vaadinServlet’

Available routes:
mock
This detailed message is only shown when running in development mode.

I have attached a log file with all set to debug. Maybe that shows the error.

I can see one Exception that points out that there might be an exception with the async request/response handling:
java.lang.Exception: null

at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doClose(NioEndpoint.java:1165) [tomcat-embed-core-9.0.22.jar:9.0.22]

at org.apache.tomcat.util.net.SocketWrapperBase.close(SocketWrapperBase.java:394) [tomcat-embed-core-9.0.22.jar:9.0.22]

at org.apache.tomcat.util.net.NioEndpoint$Poller.cancelledKey(NioEndpoint.java:667) [tomcat-embed-core-9.0.22.jar:9.0.22]

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) [tomcat-embed-core-9.0.22.jar:9.0.22]

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.22.jar:9.0.22]

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_212]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_212]

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.22.jar:9.0.22]

at java.lang.Thread.run(Unknown Source) [na:1.8.0_212]

If I remove the serlvet Registration code of apache CXF the vaadin UI comes up normally…
Without any exceptions.

How can I configure this setup correctly so that I can run in the same spring boot a webservice and Vaadin?

Tank you for any help or guidance.

Best Regards Michel

17934655.zip (1.3 MB)

private VTabSheet sheet = new VTabSheet();

There is no component called VTabSheet in Vaadin 13. Is this your own class or do you have some Vaadin 8 version your class path as well. VTabSheet is found in Vaadin 8 and there it is the client side implementation of TabSheet and should not be used in server side code.

Hi

It’s my own component. But it also doesn’t work if I just add a button.
Thank you
Regards Michel

Hi
I solved it with the Forum Entry: https://vaadin.com/forum/thread/17374548/change-url-mapping-for-vaadin-flow-and-spring

Added these Properties to application.properties
vaadin.urlMapping=/ui/*
server.servlet.context-path=/

Added the Bean in the Springboot app
@Bean
public ServletRegistrationBean springServlet(ApplicationContext context) {
return new ServletRegistrationBean<>(new SpringServlet(context, true), “/ui/", "/frontend/”);
}

Now I can serve my services and see the UI.
Cheers
Michel