パスを "/"と異なるものに変更すると、404エラーが発生します。その後、私はコンテキストパスを持つ特定の問題があることそれは私には思える/manager/textでコンテキストを混乱させたtomcat7-maven-pluginを展開する
http://localhost:8080/authenticate 404 (Not Found)
を取得しますが、私は修正する方法がわからない以下のpom.xmlに
<plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><path>/any_word</path><url>http://localhost:8080/manager/text</url>
を使用する場合、私は、意味しますそれ。私はそのアプリケーションを私のローカルのTomcatで動かすことができましたが、確かに私は同じアプローチを生産に適用することはできません。私はTomcatで見つかった "/"デフォルトを削除しました。それから、 "any_word"を削除し、pom.xmlに "/"を残しました。アプリケーションを完璧に動かすことができますが、サーバー管理者は特定の一意のコンテキストパスを必要とするため、アプリケーションをルートパス "/"に配置することはできません。
私はすべてのステップの下に追加し、私の質問に関連する情報を提供します。私は個人的な観点から重要度の低いものから重要なものへと注文しました(私はpom.xmlで何か問題があると信じていますが、間違っているかもしれないし、Springの設定やTomcat Serverのプロパティを変更しなければなりません)。
前回の起動時に "mvn tomcat7:deploy"の代わりに "mvn clean install tomcat7:run-war"を起動/展開してもブラウザーにはlocalhost:8080/calories-trackerが表示されますTomcatサーバー。
1 - 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) {
TomcatManager(http://localhost:8080/manager/html/list)
で、私は「/」2アンデプロイ
4 - catalina.properties
spring.profiles.active=development
5 - のsettings.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で上記のように変更を加えました。
私はあなたのプロジェクトをクローンし、tomcat7プラグインに '/test 'を入れました。アプリケーションがコンテキストパスをテストするためにアプリケーションをデプロイしますが、cssと画像は、アプリケーションがルートパスでそれらを見つけることを期待しているので、うまくいきません。 –
Apostolos
Apostolos、どうすればこの問題を解決できますか?アプリケーションのどこで変更する必要がありますか?私はAngularJSに非常に限定されていますが、AngularJSの設定でいくつか変更する必要がありますか? –
私はそれをチェックさせて、私はパスを正しく設定する方法を見つけたら、私は私の答えを投稿します:) – Apostolos