![](/img/trans.png)
[英]How to set up tomcat context path for web application? .war file name is coming infront of the application name in the url
[英]Is the name of web application always the name of the war?
我正在嘗試在Tomcat上安裝XWiki。 我檢查了web.xml並發現:
<display-name>xwiki</display-name>
<description>XWiki Application</description>
但是localhost:8080/xwiki
返回錯誤404:
說明所請求的資源(/ xwiki)不可用。
我還發現:
<servlet-mapping>
<servlet-name>XWikiService</servlet-name>
<url-pattern>/XWikiService</url-pattern>
</servlet-mapping>
但是同樣的問題:
說明所請求的資源(// XWikiService)不可用。
我的安裝有問題嗎? 我在catalina.out中沒有發現任何錯誤。 但是當我嘗試使用戰爭名稱時:
本地主機:8080 / xwiki-enterprise-web-4.1.2 /
有用!
我應該檢查什么?
web.xml
display-name
與用於訪問資源的URL對象無關,它只是顯示的簡短名稱或說明,取決於容器使用。 在Tomcat中,它在管理應用程序中使用。
url_pattern
應該引用一個servlet,但是您可能缺少該對象的某些部分。 webapp通常由WAR的名稱來引用(取決於容器),因此,如果您的WAR(在其中找到了web.xml
)被命名為xwiki-enterprise-web-4.1.2
,那么您應該嘗試:
localhost:8080/xwiki-enterprise-web-4.1.2/XWikiService
來訪問servlet,並且 localhost:8080/xwiki-enterprise-web-4.1.2/
加載localhost:8080/xwiki-enterprise-web-4.1.2/
應用程序。 如果后者失敗,則您可以嘗試使用welcome-file
屬性將其默認為加載特定文件。
加載時具體起作用的是什么: localhost:8080/xwiki-enterprise-web-4.1.2/
? 這會加載您的Web應用程序嗎? 您是否只想知道servlet的URL? 如果是這樣,請嘗試以下操作: localhost:8080/xwiki-enterprise-web-4.1.2/XWikiService
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.