鍍金池/ 問答/Java  Linux/ 在linux下用tomcat部署java web項目404

在linux下用tomcat部署java web項目404

war 包 丟在了 webappas 目錄下面:ci-0.1.war 自動生成了ci-0.1的目錄。

運行 catalina.sh run 訪問鏈接
http://ip:8080/ci-0.1/ 報了 404

web.xml配置

關(guān)鍵部分1:
   <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <Context path="/" docBase="/opt/app/ctpsp/tomcat7/webapps/ci-0.1" debug="0" privileged="true" reloadable="true" />


        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
      
關(guān)鍵部分2 :
  <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" URIEncoding="UTF-8"/>      
      
      

報錯如下:

16:41:08.556 [http-bio-8080-exec-23] DEBUG o.s.w.s.h.SimpleUrlHandlerMapping - Mapping [/manager/html] to HandlerExecutionChain with handler [org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler@589b3062] and 1 interceptor
16:41:08.556 [http-bio-8080-exec-23] DEBUG o.s.web.servlet.DispatcherServlet - Last-Modified value for [/manager/html] is: -1
16:41:08.556 [http-bio-8080-exec-23] DEBUG o.s.web.servlet.DispatcherServlet - Null ModelAndView returned to DispatcherServlet with name 'mvc-dispatcher': assuming HandlerAdapter completed request handling
16:41:08.556 [http-bio-8080-exec-23] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
16:41:08.553 [http-bio-8080-exec-1] DEBUG o.s.w.s.h.SimpleUrlHandlerMapping - URI Template variables for request [/manager/html] are {}
16:41:08.557 [http-bio-8080-exec-1] DEBUG o.s.w.s.h.SimpleUrlHandlerMapping - Mapping [/manager/html] to HandlerExecutionChain with handler [org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler@589b3062] and 1 interceptor
16:41:08.557 [http-bio-8080-exec-1] DEBUG o.s.web.servlet.DispatcherServlet - Last-Modified value for [/manager/html] is: -1
16:41:08.557 [http-bio-8080-exec-1] DEBUG o.s.web.servlet.DispatcherServlet - Null ModelAndView returned to DispatcherServlet with name 'mvc-dispatcher': assuming HandlerAdapter completed request handling
16:41:08.557 [http-bio-8080-exec-1] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
回答
編輯回答
臭榴蓮

@ccfish @捏造的信仰 先謝謝兩位的回答,最起碼啟發(fā)了我回去看看80的問題。

問題解決了,問題出在tomcat本身問題,哎,由于是和別人提供的服務器,所以tomcat本身出了問題,重新?lián)Q了個包,解決了80訪問的問題,然后war那邊是 db 配置的問題。

一開始沒有考慮過tomcat這么基礎(chǔ)的東西,也會弄錯,所以一直沒找到原因。

2018年2月12日 23:19
編輯回答
只愛你

你實子配置的話 http://ip:8080/ 能不能訪問?path="/"

2017年5月6日 05:15
編輯回答
瘋浪

我沒見過將 webapp 既丟到 webapps 目錄下,又在 server.xml 里面配置成根目錄的。這樣做恐怕會出現(xiàn)沖突。先刪除 <Context/> 配置,然后看 http://xxx:8080/ci-0.1 能否正常訪問。

2017年8月23日 07:26