tomcat启动成功,但是项目没有部署上!!!

BlueYuFIsher 2017-12-19 03:39:34
我再本地是用Spring Tool Suite软件跑是没问题的。


然后通过打包war包扔到阿里云的服务器上(Linux)的tomcat里面部署,运行tomcat,什么错误都没报,页面可以访问,可是接口全都不能访问。求助大神啊!!!!



网上说的配置路径什么的我都弄了,可是还是加载不了。
...全文
5513 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
RockeyCui 2018-07-19
  • 打赏
  • 举报
回复
访问路径不应该加上项目名吗 127.0.0.1:8080/projectname/longin.do
east123321 2018-07-19
  • 打赏
  • 举报
回复
部署到Linux上的时候,项目中的文件路径有没有全部修改为Linux的路径?
JadeLu_Peng 2018-07-17
  • 打赏
  • 举报
回复
不是tomcat的事,更不是开发工具的事,,,,是你架包或者是文件不全引起的,说白了就是你项目的事,你可以在svn上还原一下,再更新一下,耐心等待build workspace,下完相应的jar
卡卡罗特琪琪 2018-07-17
  • 打赏
  • 举报
回复
是不war包自动解压之后,文件夹里是双层目录,也就是有重复的文件夹名,我之前也碰到过这种情况,myeclipse是好的,但是用war包就不行了,之后打开解压后的没想到里边还有一层,最后放在最外面就可以正常访问了,不知道你是这种情况吗,希望可以帮到你。
BlueYuFIsher 2017-12-25
  • 打赏
  • 举报
回复
引用 16 楼 hanpoyangtitan 的回复:
[quote=引用 15 楼 congshenli4955 的回复:]
你有没有把war放到本地的tomcat里试下?


有啊,可以很顺利的跑起来


然后我之前试过本地跑也出现过同样的情况,我点击了service.bat 就没问题了,我在想是不是同样的问题……
什么都不能 2017-12-22
  • 打赏
  • 举报
回复
引用 15 楼 congshenli4955 的回复:
我现在试了两种情况,一种是直接用ROOT,一种是用我项目名称,可是都是一样,都不行,都是一样的情况………………
你有没有把war放到本地的tomcat里试下?
什么都不能 2017-12-21
  • 打赏
  • 举报
回复
引用 9 楼 congshenli4955 的回复:
再说说我的情况,我在本地上的tomcat 是可以运行的,一点问题都没有,就很纳闷为什么部署到服务器上就不行了!!!
有没有打印日志?
什么都不能 2017-12-21
  • 打赏
  • 举报
回复
引用 13 楼 congshenli4955 的回复:
[quote=引用 10 楼 hanpoyangtitan 的回复:] [quote=引用 9 楼 congshenli4955 的回复:] 再说说我的情况,我在本地上的tomcat 是可以运行的,一点问题都没有,就很纳闷为什么部署到服务器上就不行了!!!
有没有打印日志?[/quote] 只有tomcat 打印日志了,可是没有项目运行起来的日志,我在项目里面设置了日志的,我看在本地跑的时候会打自动打日志的,现在完全没有。[/quote] 我刚看你的server.xml中contextpath配置的是/web 你访问的地址是不是少了这个?
BlueYuFIsher 2017-12-21
  • 打赏
  • 举报
回复
引用 10 楼 hanpoyangtitan 的回复:
[quote=引用 9 楼 congshenli4955 的回复:] 再说说我的情况,我在本地上的tomcat 是可以运行的,一点问题都没有,就很纳闷为什么部署到服务器上就不行了!!!
有没有打印日志?[/quote] 只有tomcat 打印日志了,可是没有项目运行起来的日志,我在项目里面设置了日志的,我看在本地跑的时候会打自动打日志的,现在完全没有。
BlueYuFIsher 2017-12-21
  • 打赏
  • 举报
回复
没有啊
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation. The default
         SSLImplementation will depend on the presence of the APR/native
         library and the useOpenSSL attribute of the
         AprLifecycleListener.
         Either JSSE or OpenSSL style configuration may be used regardless of
         the SSLImplementation selected. JSSE style configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
         This connector uses the APR/native implementation which always uses
         OpenSSL for TLS.
         Either JSSE or OpenSSL style configuration may be used. OpenSSL style
         configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
                         certificateFile="conf/localhost-rsa-cert.pem"
                         certificateChainFile="conf/localhost-rsa-chain.pem"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
		  <Context docBase="web-module-1.0.0" path="/web"  reloadable="true" ></Context>

        <!-- 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 "%r" %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>
qq_29548659 2017-12-21
  • 打赏
  • 举报
回复
看一下tomcat的server.xml 里面有一个<Context path="/"/>看path是不是/
BlueYuFIsher 2017-12-21
  • 打赏
  • 举报
回复
我现在试了两种情况,一种是直接用ROOT,一种是用我项目名称,可是都是一样,都不行,都是一样的情况………………


什么都不能 2017-12-20
  • 打赏
  • 举报
回复
页面可以访问是什么意思?
BlueYuFIsher 2017-12-20
  • 打赏
  • 举报
回复
再说说我的情况,我在本地上的tomcat 是可以运行的,一点问题都没有,就很纳闷为什么部署到服务器上就不行了!!!
BlueYuFIsher 2017-12-20
  • 打赏
  • 举报
回复
引用 7 楼 hanpoyangtitan 的回复:
页面可以访问是什么意思?

就是我用我的ip加端口是可以直接访问的,然后现在是出现了一个奇怪的问题,接口报Failed to load resource: the server responded with a status of 404 (OK)错误!! OK???


BlueYuFIsher 2017-12-19
  • 打赏
  • 举报
回复
这些我都弄配置了……
什么都不能 2017-12-19
  • 打赏
  • 举报
回复 1
引用 4 楼 congshenli4955 的回复:
[quote=引用 2 楼 hanpoyangtitan 的回复:] springboot 打成jar 运行
我把war包扔进去webapps里面后,它是会自动解压的,可是就是不加载,困扰了很久了。[/quote] 你的方法不对,要不就打成war,pom.xml 中 <packaging>war</packaging>, 要不就用java -jar #{appname}.jar 方法执行,使用war的话入口要改造 用war的话要用监听器启动springboot,jar在main中初始化 import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.SpringBootServletInitializer; public class ServletInitializer extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } }
BlueYuFIsher 2017-12-19
  • 打赏
  • 举报
回复
引用 2 楼 hanpoyangtitan 的回复:
springboot 打成jar 运行
我把war包扔进去webapps里面后,它是会自动解压的,可是就是不加载,困扰了很久了。
BlueYuFIsher 2017-12-19
  • 打赏
  • 举报
回复
引用 2 楼 hanpoyangtitan 的回复:
springboot 打成jar 运行
也不行啊……
什么都不能 2017-12-19
  • 打赏
  • 举报
回复
springboot 打成jar 运行
加载更多回复(1)

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧