2017-07-05 31 views
0

春の起動アプリケーションをWARとしてTomcatサーバーに展開しようとしています。私は構築し、Tomcatサーバーに戦争を展開することができます。私の春のアプリケーションは実行されませんが、私はサーバーを起動します。サーバーはうまく起動します。私は私のプロジェクトは、独自のカスタム親POMを持っており、2つのモジュールで構成され、すべての春はここにやって言う春の起動アプリケーションがTomcatサーバーで起動しない

http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file

を行っています。

私はいくつかの他の同様のスレッドを読んでいますが、私はすべてを正しく設定しているとは言えますが、明らかに何かが間違っています。どんな助けでも大歓迎です。

THank You!

親ポンポン

<groupId>com.project</groupId> 
<artifactId>TelematicsNotificationSystem</artifactId> 
<name>TelematicsNotificationSystem</name> 
<version>1.0.0-SNAPSHOT</version> 
<packaging>pom</packaging> 

<properties> 
    <java.version>1.8</java.version> 
    <artifact-deployer.version>2.0.0-RELEASE</artifact-deployer.version> 
    <cxf.version>2.5.2</cxf.version> 
    <start-class>com.project.TNS.TelematicsNotificationSystem</start-class> 
</properties> 

<modules> 
    <module>TelematicsNotificationSystem-wsclient</module> 
    <module>TelematicsNotificationSystem-web</module> 
</modules> 

<dependencies> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-thymeleaf</artifactId> 
     <version>1.5.0.RELEASE</version> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
     <version>1.5.0.RELEASE</version> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-tomcat</artifactId> 
     <scope>provided</scope> 
     <version>1.5.0.RELEASE</version> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-devtools</artifactId> 
     <optional>true</optional> 
     <version>1.5.0.RELEASE</version> 
    </dependency> 

    <dependency> 
     <groupId>com.sun.mail</groupId> 
     <artifactId>javax.mail</artifactId> 
     <version>1.5.6</version> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.ldap</groupId> 
     <artifactId>spring-ldap-core</artifactId> 
     <version>1.3.0.RELEASE</version> 
    </dependency>  
</dependencies> 

Webプロジェクトポンポン

<artifactId>TelematicsNotificationSystem-Web</artifactId> 
<name>TelematicsNotificationSystem-Web</name> 
<packaging>war</packaging> 


<parent> 
    <groupId>com.project</groupId> 
    <artifactId>TelematicsNotificationSystem</artifactId> 
    <version>1.0.0-SNAPSHOT</version> 
</parent> 

<properties> 
    <start-class>com.project.TNS.TelematicsNotificationSystem</start-class> 
</properties> 



<build> 
    <plugins> 
     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId> 
      <configuration> 
       <resources> 
       <resource> 
        <filtering>true</filtering> 
        <directory>src/main/resources/</directory> 
       </resource> 
       </resources> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

マイアプリケーションクラス

package TNS; 

import org.springframework.boot.SpringApplication; 
import org.springframework.boot.autoconfigure.SpringBootApplication; 
import org.springframework.boot.builder.SpringApplicationBuilder; 
import org.springframework.boot.context.web.SpringBootServletInitializer; 

@SpringBootApplication 
public class TelematicsNotificationSystem extends SpringBootServletInitializer{ 

public static void main(String[] args) { 
    SpringApplication.run(TelematicsNotificationSystem.class, args); 
} 

@Override 
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 
    return application.sources(TelematicsNotificationSystem.class); 
} 

+0

どのように戦争をTomcatに展開していますか? – ck1

+0

tomcat logsディレクトリのcatalina.outおよびlocalhostログファイルを確認してください。任意の設定エラーを記録することがあります。 –

+1

まず、依存関係を修正するには、Springブート1.3.3,1.3.0,1.5.0のjarファイルを混在させます。それに続いて、旧バージョンの互換性のないバージョンのスプリングコンテキストサポートが追加されています(すでに他の場所に引き込まれている依存関係を削除します)。メールの依存関係を 'spring-boot-starter-mail'に置き換えます。私はまた、あなたの親がsprigのブートの親を拡張してからwarプラグインを削除することを強くお勧めします(これはもう必要ありません)。 –

答えて

0

私は全体的な修正ではなかった私のPomをきれいにする必要があるとDeinumに同意しますが。修正は、私の主な方法が含まれているクラスにコンポーネントスキャンを追加することでした。

@SpringBootApplication 
@ComponentScan(basePackageClasses = DashBoardController.class) 
public class TelematicsNotificationSystem extends SpringBootServletInitializer 

開始アプリがコントローラを見つけられなかったので、自分のマッピング要求を処理できました。

関連する問題