Vaadin Spring App not found by server

I have a simple Vaadin Spring App. The following code is supposed make it possible for the browser to find the app under the address http://localhost:8080/MyApp/ui :

[code]
@SpringUI(path = “/ui”)
public class MyUI extends UI {

@Override protected void init(VaadinRequest vaadinRequest) {
      //bla
}

}
[/code]However, I’m getting a 404 error.

To check that the server was working correctly I created a file “index.html” in the WebContent Folder of the app. I directed my browser to http://localhost:8080/MyApp and the content was displayed correctly.

However, http://localhost:8080/MyApp/ui is giving me a 404 error

Does anybody have a clue what might be the problem?

Have you checked in your logs that the Vaadin servlet has been initialized?

You shuold see log lines similiar to the following

...
Servlet will be mapped to URLs 
[/vaadinServlet/*, /VAADIN/*]
...
Mapping servlet: 'springVaadinServlet' to 
[/vaadinServlet/*, /VAADIN/*]
...
Forwarding @SpringUI URLs from {/ui=org.springframework.web.servlet.mvc.ServletForwardingController@310b2d9b, /ui/=org.springframework.web.servlet.mvc.ServletForwardingController@310b2d9b}
...
Mapped URL path 
[/ui] onto handler of type [class org.springframework.web.servlet.mvc.ServletForwardingController]

Mapped URL path 
[/ui/] onto handler of type [class org.springframework.web.servlet.mvc.ServletForwardingController]

....

Below you see the output I get in the console when running the application. … Apparently the servlet doesn’t get initialized. How can I make the Vaadin servlet get initialized?

Aug 18, 2017 7:55:42 PM org.apache.tomcat.util.digester.SetPropertiesRule begin

WARNING: [SetPropertiesRule]
{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:demo’ did not find a matching property.

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: Server version: Apache Tomcat/8.5.16

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: Server built: Jun 21 2017 17:01:09 UTC

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: Server number: 8.5.16.0

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: OS Name: Mac OS X

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: OS Version: 10.12.6

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: Architecture: x86_64

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: Java Home: /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: JVM Version: 1.8.0_111-b14

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: JVM Vendor: Oracle Corporation

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: CATALINA_BASE: /Users/thomasoechsle/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: CATALINA_HOME: /Users/thomasoechsle/apache-tomcat-8.5.16

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:56447

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: Command line argument: -Dcatalina.base=/Users/thomasoechsle/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: Command line argument: -Dcatalina.home=/Users/thomasoechsle/apache-tomcat-8.5.16

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: Command line argument: -Dwtp.deploy=/Users/thomasoechsle/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: Command line argument: -Djava.endorsed.dirs=/Users/thomasoechsle/apache-tomcat-8.5.16/endorsed

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.VersionLoggerListener log

INFO: Command line argument: -Dfile.encoding=UTF-8

Aug 18, 2017 7:55:42 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent

INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path:
[/Users/thomasoechsle/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]

Aug 18, 2017 7:55:42 PM org.apache.coyote.AbstractProtocol init

INFO: Initializing ProtocolHandler [“http-nio-8089”]

Aug 18, 2017 7:55:42 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector

INFO: Using a shared selector for servlet write/read

Aug 18, 2017 7:55:42 PM org.apache.coyote.AbstractProtocol init

INFO: Initializing ProtocolHandler [“ajp-nio-8009”]

Aug 18, 2017 7:55:42 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector

INFO: Using a shared selector for servlet write/read

Aug 18, 2017 7:55:42 PM org.apache.catalina.startup.Catalina load

INFO: Initialization processed in 1188 ms

Aug 18, 2017 7:55:42 PM org.apache.catalina.core.StandardService startInternal

INFO: Starting service [Catalina]

Aug 18, 2017 7:55:42 PM org.apache.catalina.core.StandardEngine startInternal

INFO: Starting Servlet Engine: Apache Tomcat/8.5.16

Aug 18, 2017 7:55:43 PM org.apache.coyote.AbstractProtocol start

INFO: Starting ProtocolHandler [“http-nio-8089”]

Aug 18, 2017 7:55:43 PM org.apache.coyote.AbstractProtocol start

INFO: Starting ProtocolHandler [“ajp-nio-8009”]

Aug 18, 2017 7:55:43 PM org.apache.catalina.startup.Catalina start

INFO: Server startup in 695 ms

Are you using spring boot? If so all the stuff should be autoconfigured.
Otherwise try to follow the instructions at
http://vaadin.github.io/spring-tutorial/#_configuring_and_using_vaadin_spring_without_spring_boot

HTH
Marco