2016-07-13 106 views
0

我已將Web應用程序部署到Tomcat 7.0.47,但是我看到404狀態。 我可以正常訪問Tomcat主頁和Tomcat應用程序管理器。Tomcat 7已部署Web應用程序404狀態

Tomcat Web Application Manager

HTTP Status 404

下面是日誌文件: catalina.2016-07-13

Jul 13, 2016 8:51:29 AM org.apache.catalina.core.AprLifecycleListener init 
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_31\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;F:\MATLAB\R2014a\runtime\win64;F:\MATLAB\R2014a\bin;C:\Program Files\MATLAB\R2012a\runtime\win64;C:\Program Files\MATLAB\R2012a\bin;C:\Program Files (x86)\PharosSystems\Core;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\Doctrine extensions for PHP\;C:\Program Files\apache-maven-3.3.9-bin\bin;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;. 
Jul 13, 2016 8:51:29 AM org.apache.coyote.AbstractProtocol init 
INFO: Initializing ProtocolHandler ["http-bio-8080"] 
Jul 13, 2016 8:51:29 AM org.apache.coyote.AbstractProtocol init 
INFO: Initializing ProtocolHandler ["ajp-bio-8009"] 
Jul 13, 2016 8:51:29 AM org.apache.catalina.startup.Catalina load 
INFO: Initialization processed in 514 ms 
Jul 13, 2016 8:51:29 AM org.apache.catalina.core.StandardService startInternal 
INFO: Starting service Catalina 
Jul 13, 2016 8:51:29 AM org.apache.catalina.core.StandardEngine startInternal 
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47 
Jul 13, 2016 8:51:29 AM org.apache.catalina.startup.HostConfig deployWAR 
INFO: Deploying web application archive C:\apache-tomcat-7.0.47\webapps\cs144.war 
Jul 13, 2016 8:51:30 AM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory C:\apache-tomcat-7.0.47\webapps\docs 
Jul 13, 2016 8:51:30 AM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory C:\apache-tomcat-7.0.47\webapps\examples 
Jul 13, 2016 8:51:30 AM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory C:\apache-tomcat-7.0.47\webapps\host-manager 
Jul 13, 2016 8:51:31 AM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory C:\apache-tomcat-7.0.47\webapps\manager 
Jul 13, 2016 8:51:31 AM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory C:\apache-tomcat-7.0.47\webapps\ROOT 
Jul 13, 2016 8:51:31 AM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory C:\apache-tomcat-7.0.47\webapps\Struts2Example 
Jul 13, 2016 8:51:31 AM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory C:\apache-tomcat-7.0.47\webapps\zurmo 
Jul 13, 2016 8:51:31 AM org.apache.coyote.AbstractProtocol start 
INFO: Starting ProtocolHandler ["http-bio-8080"] 
Jul 13, 2016 8:51:31 AM org.apache.coyote.AbstractProtocol start 
INFO: Starting ProtocolHandler ["ajp-bio-8009"] 
Jul 13, 2016 8:51:31 AM org.apache.catalina.startup.Catalina start 
INFO: Server startup in 1435 ms 

localhost.2016-07-13

Jul 13, 2016 8:51:30 AM org.apache.catalina.core.ApplicationContext log 
INFO: ContextListener: contextInitialized() 
Jul 13, 2016 8:51:30 AM org.apache.catalina.core.ApplicationContext log 
INFO: SessionListener: contextInitialized() 
Jul 13, 2016 8:51:30 AM org.apache.catalina.core.ApplicationContext log 
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', '[email protected]') 

localhost_access_log.2016-07-13

0:0:0:0:0:0:0:1 - admin [13/Jul/2016:08:53:14 +0430] "POST /manager/html/upload?org.apache.catalina.filters.CSRF_NONCE=210FE5528CB1E9D58F23E5A11655B102 HTTP/1.1" 403 3287 
0:0:0:0:0:0:0:1 - - [13/Jul/2016:08:53:14 +0430] "GET /favicon.ico HTTP/1.1" 200 21630 
0:0:0:0:0:0:0:1 - - [13/Jul/2016:08:53:18 +0430] "GET /manager/ HTTP/1.1" 302 - 
0:0:0:0:0:0:0:1 - admin [13/Jul/2016:08:53:18 +0430] "GET /manager/html?org.apache.catalina.filters.CSRF_NONCE=7D8792E571C6ABBD8D35351293AF54B8 HTTP/1.1" 200 20949 
0:0:0:0:0:0:0:1 - - [13/Jul/2016:08:53:33 +0430] "GET /cs144/ HTTP/1.1" 404 963 

manager.2016-07-13

Jul 13, 2016 8:53:14 AM org.apache.catalina.core.ApplicationContext log 
INFO: HTMLManager: init: Associated with Deployer 'Catalina:type=Deployer,host=localhost' 
Jul 13, 2016 8:53:14 AM org.apache.catalina.core.ApplicationContext log 
INFO: HTMLManager: init: Global resources are available 
Jul 13, 2016 8:53:18 AM org.apache.catalina.core.ApplicationContext log 
INFO: HTMLManager: list: Listing contexts for virtual host 'localhost' 
+1

「cs144」webapp是如何配置的?它是否包含'index.jsp'或'index.html'文件?還是有一個servlet被配置爲處理'/'請求? –

+0

感謝您的迴應,它包含results.jsp,但我不知道如何配置servlet來處理/請求。你能告訴我我該怎麼做嗎? –

+1

使用'web.xml'中的''工具。在嘗試之前,請繼續查看對/ cs144/results.jsp的請求是否成功。如果是這樣,你只需要一個''將'/'的請求重新路由到'/ results.jsp'。 –

回答

0

你需要做的是使用該設施在web.xml

servlet規範爲應用程序提供了一種工具,用於指示客戶端在路徑中未指定哪個文件時應使用哪些文件。 GET /directory/。您可以根據需要指定任意數量的文件,並使用找到的第一個文件。所以你可以有index.html在那裏以及任何你可能想要的東西。默認列表(按順序):

  • index.html
  • index.htm
  • index.jsp

如果您在web.xml指定<welcome-file-list>,你會覆蓋默認。因此,如果您希望能夠回退到原始列表,您需要指定所有選項。

例子:

web.xml

... 
... 
<welcome-file-list> 
    <welcome-file>results.jsp</welcome-file> 
    <welcome-file>index.html</welcome-file> 
    <welcome-file>index.htm</welcome-file> 
    <welcome-file>index.jsp</welcome-file> 
</welcome-file-list> 
... 
... 

web.xml文件應該在你的應用程序的WEB-INF/web.xml,而且很可能已經存在。確保你按照schema並把它放在正確的地方。

相關問題