Servlet Container Question (Tomcat)

I apologize for this admittedly simple question, but I am brand new to both Vaadin and Servlet containers.

The question I have revolves around the servlet-mapping in the web.xml. My mappings are as follows:

[font=Courier New]

My App /* My App /VAADIN/*

[/font]

  1. As for the second mapping, I read a few snippets that said you need this extra VAADIN/* mapping, but I don’t understand why?

  2. If the main servlet mapping is /*, then won’t that override the default admin console of the Application Servlet container (i.e. Tomcat)? Won’t that make

    http://localhost:8080

map to the Vaadin app instead of the server’s admin console (which is the page you get when not running the Vaadin app). I would think you would not want to do this in practice.

  1. When I run my app from Jetbrains IDEA, and it deploys to Tomcat, I keep getting a “requested resource not found” error page when hitting localhost:8080. The app was working for a while, and then I made some UI related changes in my code, and all of a sudden it stopped working.

Any insights or advice would be appreciated!

The /* mapping in the web.xml is relative to the application deployment directory. If I for example have application called Calendar and I’ve deployed it to Tomcat as Calendar, I access it with localhost:8080/Calendar when I have /* mapping in place.

If I change the /* mapping to for example /calendar, it would mean that my application is now mapped to:

localhost:8080/Calendar/calendar

VAADIN/* mapping is used for the widgetset and static resources so they can be found even if you don’t have the default mapping of /* in use. See for example
this
thread.

I think your third question is related to the deployment of your application as explained above.

Howdy,

As a little background, here is a full URL that you might see when running your app:

://[:port]

[/contextroot]
[/path]

So if you have a servlet mapped to /foo in a war file called myapp.war, when you deploy to Tomcat your default URL would be: http://host:8080/myapp/foo. A second servlet at /bar would be found at http://host:8080/myapp/bar. Thus, you can have several servlets within an application, and several applications all deployed at host:8080.

If your application servlet is mapped to /*, then the URL is simply: http://host:8080/myapp

So, yes, the second mapping is unnecessary. Sometimes people want other pages to live at the top level, like a login page, so they map the Vaadin servlet to something else. In that case, you need the /VAADIN/* mapping as well.

No, because there’s still the context root for the application itself, which by default is the war file name. To really run your app at localhost:8080 without other information, you would need to deploy with context root / and have servlet mapping set to / or /*. In production, this is exactly what you’d do. You don’t want end users to go to your server’s administration page. :slight_smile:

This part I can’t help you with without more information. Make sure you’re actually redeploying instead of just recompiling the code. Also check the server logs in case there are helpful messages there.

Cheers,
Bobby