【问题标题】:spring without xml - 404 after deploying on tomcat在tomcat上部署后没有xml的spring - 404
【发布时间】:2018-06-19 20:26:56
【问题描述】:

未配置 xml 的 Spring 应用程序。

通过 Tomcat 上的 IDEA 进行部署 - 一切正常;

但是如果通过 maven plagin 打包到 WAR

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-war-plugin</artifactId>
   <version>3.0.0</version>
   <executions>
      <execution>
         <id>default-war</id>
         <phase>prepare-package</phase>
         <configuration>
            <warName>appName</warName>
            <failOnMissingWebXml>false</failOnMissingWebXml>
         </configuration>
      </execution>
   </executions>
</plugin>

部署后:Tomcat 显示 404 错误

【问题讨论】:

    标签: spring tomcat


    【解决方案1】:

    需要将 webapp 目录的路径添加到插件的 configuration 部分

    <webappDirectory>src/main/webapp</webappDirectory>
    

    【讨论】:

      猜你喜欢
      • 2021-05-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-31
      • 2019-04-12
      • 2014-02-27
      • 2019-02-27
      • 1970-01-01
      相关资源
      最近更新 更多