Is the name of web application always the name of the war?
Question
I'm trying to install XWiki on Tomcat. I have checked the web.xml and found:
<display-name>xwiki</display-name>
<description>XWiki Application</description>
But localhost:8080/xwiki
returns error 404:
description The requested resource (/xwiki) is not available.
I also found:
<servlet-mapping>
<servlet-name>XWikiService</servlet-name>
<url-pattern>/XWikiService</url-pattern>
</servlet-mapping>
But the same problem:
description The requested resource (//XWikiService) is not available.
Is something wrong with my installation? I didn't found any error in catalina.out. But when I try war name:
localhost:8080/xwiki-enterprise-web-4.1.2/
It works!
What should I check?
La solution
display-name
in web.xml
has nothing to do with the URL object used to access the resource, it is only a short name or description to display, used depending on the container. In Tomcat, it's used in the management application.
url_pattern
should refer to a servlet, but you're probably missing some part of the object. webapps are typically referred to by the name of the WAR (depending on the container), so if your WAR (where web.xml
is found) is named xwiki-enterprise-web-4.1.2
, then you should try:
localhost:8080/xwiki-enterprise-web-4.1.2/XWikiService
to access the servlet, andlocalhost:8080/xwiki-enterprise-web-4.1.2/
to load the webapp.
If the latter fails, then you might try to use the welcome-file
attribute to default to loading a specific file.
What is it specifically that works when you load: localhost:8080/xwiki-enterprise-web-4.1.2/
? Does this load your webapp? Do you just want to know the URL of the servlet? If so then try this: localhost:8080/xwiki-enterprise-web-4.1.2/XWikiService
Autres conseils
You need to configure the Context in Tomcat. There are several places where you can define the context, and it's the path
attribute that defines the "name of the web application" that you are looking for.