2016-07-01 26 views
0

私は春休みと春のブートを使用して残りのAPIを作成しました。私はTomcatのための正確な春のブート命令を以下の午前春休み休憩風船展開エラー

rror during ServletContainerInitializer processing 
javax.servlet.ServletException: Failed to instantiate WebApplicationInitializer class  at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:160 
Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.server.ResourceConfig 

:私はLinuxサーバ上のTomcatにデプロイしようとしていたとき、私は次のエラーを取得します。私の質問は、私がジャージー関連のコードを探している理由、そして私がそれをどのように修正することができるのかということです。

public class Application extends SpringBootServletInitializer { 

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

} 

Contollerコード:

@RestController 
@RequestMapping("/rest/cmscontent") 
public class BatchController { 
+0

あなたはpom.xmlを共有できますか?それには問題が含まれている可能性があります – rajadilipkolli

+0

'ClassNotFoundException'の完全なスタックトレースは何ですか? –

+0

@Raja、私はGradleを使用しています。ここにはdependencies.compile( "org.springframework.boot:spring-boot-starter-web")があります。 compile( "org.springframework.boot:spring-boot-starter-jersey")コンパイル( "org.apache.commons:commons-lang3:3.4") コンパイル( "net.sf.ehcache:ehcache:2.10私は、以来 org.springframework:ばねコンテキストサポート」){ '石英') は(モジュールを除外}:0.0 "{org.slf4j " コンパイル() ) は(グループを除外します"}"ジャージーを使用していない、ジャージーを不平にしている理由 – raigeek

答えて

0

あなたが依存関係として、あなたのPOMファイルにspring-boot-starter-webを追加した場合、
それが自動的に埋め込まれたWebコンテナ(デフォルトのTomcat)が含まれます。
したがって、JARをWebコンテナにデプロイせずに直接実行するだけです。