在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配置

关键部分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>
      
关键部分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
白衣染霜花
浏览 3504回答 3
3回答

慕尼黑8549860

@ccfish @捏造的信仰 先谢谢两位的回答,最起码启发了我回去看看80的问题。 问题解决了,问题出在tomcat本身问题,哎,由于是和别人提供的服务器,所以tomcat本身出了问题,重新换了个包,解决了80访问的问题,然后war那边是 db 配置的问题。 一开始没有考虑过tomcat这么基础的东西,也会弄错,所以一直没找到原因。

qq_笑_17

你实子配置的话 http://ip:8080/ 能不能访问?path="/"

慕仙森

我没见过将 webapp 既丢到 webapps 目录下,又在 server.xml 里面配置成根目录的。这样做恐怕会出现冲突。先删除 <Context/> 配置,然后看 http://xxx:8080/ci-0.1 能否正常访问。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java