Tomcat重启后Spring Boot映射无效(未找到404)

时间:2017-10-17 11:37:02

标签: rest tomcat spring-boot

我在Apache Tomcat服务器(8.5.23)上的rest.war中部署了Spring Boot Rest API应用程序的问题。复制步骤:

  1. 创建rest.war
  2. 将rest.war复制到/ webapps
  3. 启动tomcat

      

    正常工作(localhost:8080 / test / method 200 OK)

  4. 关闭tomcat

  5. 重新开始
  6. 启动tomcat

      

    工作不正确(localhost:8080 / test / method 404 NOT FOUND)

  7. 关闭tomcat

  8. 删除/休息目录
  9. 启动tomcat
      

    再次正常工作

  10. 启动时日志的差异:

    正确:

    o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory
    Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4b32c94c: startup date [Tue Oct 17 12:55:48 CEST 2017]; root of context hierarchy
    Mapped "{[/profile/{profileId}/find/{page}],methods=[POST]}" onto public someone.model.responses.ProfilesLiteResponse someone.backend.MainController.find(java.lang.Long,java.lang.Integer,someone.model.ProfileLiteQuery)
    Mapped "{[/test/{id}],methods=[GET]}" onto public someone.model.Location someone.backend.MainController.test(java.lang.String)
    Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
    o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
    o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
    o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
    

    不正确:

    o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory
    o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
    

    完整日志:

    https://paste.ofcode.org/n6ZhPysDzXYCkSDBPv2jDm
    https://paste.ofcode.org/fxquvJDjV73fuv6rfxRRkY
    

    任何人都可以解释为什么在解压缩.war后不会触发映射?任何想法赞赏!干杯,Jacek

1 个答案:

答案 0 :(得分:-1)

好的,问题已修复 - 双重依赖性存在问题