パスを「/」以外に変更すると、404 エラーが発生します。つまり、使用する場合
<plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><path>/any_word</path><url>http://localhost:8080/manager/text</url>
以下の pom.xml で取得します
http://localhost:8080/authenticate 404 (Not Found)
コンテキストパスに特定の問題があるようですが、修正方法がわかりません。ローカルの Tomcat でアプリケーションを実行することはできましたが、同じアプローチを本番環境に適用することはできません。Tomcat にある "/" デフォルトを削除しました。次に、「any_word」を削除して、「/」を pom.xml に残しました。これにより、アプリケーションは完全に実行されますが、ご想像のとおり、サーバー管理者が明らかに特定の一意のコンテキスト パスを要求するため、運用環境でアプリケーションをルート パス "/" にデプロイすることはできません。
質問に関連するすべての手順とソースを以下に追加しました。個人的な観点から、重要度の低いものから重要度の高いものへと並べ替えました (pom.xml に何か問題がある可能性はあると思いますが、間違っている可能性があり、Spring 構成または Tomcat サーバー プロパティを変更する必要があります)。
以前に起動したTomcatサーバーで「mvn tomcat7:deploy」の代わりに「mvn clean install tomcat7:run-war」を起動/展開しても、ブラウザにはlocalhost:8080/calories-trackerが表示されることに注意してください。
1 - TomcatManager 内 ( http://localhost:8080/manager/html/list )
「/」をアンデプロイしました</p>
2 - Windows のコマンド プロンプト
C:> mvn tomcat7:deploy
3 - プロファイル ("開発")
@Configuration
@Profile("development")
@EnableTransactionManagement
public class DevelopmentConfiguration {
@Bean(name = "datasource")
public DriverManagerDataSource dataSource() {
@Bean(name = "entityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DriverManagerDataSource dataSource) {
4 - カタリナ プロパティ
spring.profiles.active=development
5 - 設定.xml
<servers>
<server>
<id>tomcat8</id>
<username>admin</username>
<password>admin</password>
</server>
</servers>
6 - WebAppInitializer
public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class<?>[]{RootContextConfig.class, DevelopmentConfiguration.class, TestConfiguration.class,
AppSecurityConfig.class};
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class<?>[] {ServletContextConfig.class};
}
@Override
protected String[] getServletMappings() {
return new String[]{"/"};
}
}
7 - Web.xml
<web-app>
<display-name>Archetype Created Web Application</display-name>
<welcome-file-list>
<welcome-file>/resources/calories-tracker.html</welcome-file>
</welcome-file-list>
</web-app>
8- Pom.xml
<build>
<finalName>calories-tracker</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
<url>http://localhost:8080/manager/text</url>
<server>tomcat8</server>
<keystoreFile>${basedir}/other/keystore.jks</keystoreFile>
<keystorePass>secret</keystorePass>
</configuration>
</plugin>
</plugins>
</build>
***質問を作成してから数分後に追加 元のプロジェクトはhttps://github.com/jhades/spring-mvc-angularjs-sample-appからダウンロードできます。上記の変更をTomcatとPomで行いました。