2017-09-04 4 views
0

簡単なSpring Boot RestアプリケーションをWildfly 9.0.2サーバーに導入したいと考えています。デプロイされているようですが、いずれのサービスにもアクセスすることはできません。Wildfly 9.0.2でのSpring起動アプリケーションのデプロイ

私は、次のような様々な指示次されています: https://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html

をまだ私のために動作するようには思えません。

これは私のpom.xmlファイルである

<?xml version="1.0" encoding="UTF-8"?> 

http://maven.apache.org/xsd/maven-4.0.0.xsd "> 4.0.0

<groupId>com.vodafone.er</groupId> 
<artifactId>config-app</artifactId> 
<version>0.0.1-SNAPSHOT</version> 
<packaging>war</packaging> 

<name>config-app</name> 
<description>Demo project for Spring Boot</description> 

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.5.6.RELEASE</version> 
    <relativePath/> 
</parent> 

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
    <java.version>1.8</java.version> 
    <start-class>com.vodafone.er.configapp.ConfigAppApplication</start-class> 
</properties> 

<dependencies> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
     <exclusions> 
      <exclusion> 
       <groupId>ch.qos.logback</groupId> 
       <artifactId>logback-classic</artifactId> 
      </exclusion> 
     </exclusions> 
     <scope>provided</scope> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-tomcat</artifactId> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-test</artifactId> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>com.fasterxml.jackson.module</groupId> 
     <artifactId>jackson-module-parameter-names</artifactId> 
     <version>2.8.7</version> 
    </dependency> 
    <dependency> 
     <groupId>com.fasterxml.jackson.datatype</groupId> 
     <artifactId>jackson-datatype-jdk8</artifactId> 
     <version>2.8.7</version> 
    </dependency> 
    <dependency> 
     <groupId>com.fasterxml.jackson.datatype</groupId> 
     <artifactId>jackson-datatype-jsr310</artifactId> 
     <version>2.8.7</version> 
    </dependency> 
</dependencies> 

<!--<build>--> 
    <!--<plugins>--> 
     <!--<plugin>--> 
      <!--<groupId>org.springframework.boot</groupId>--> 
      <!--<artifactId>spring-boot-maven-plugin</artifactId>--> 
      <!--<configuration>--> 
       <!--<jvmArguments>--> 
        <!-- -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005--> 
       <!--</jvmArguments>--> 
      <!--</configuration>--> 
     <!--</plugin>--> 
    <!--</plugins>--> 
<!--</build>--> 

そして、ここに私のアプリケーション/コントローラクラスです:

@SpringBootApplication 
@ComponentScan 
@EnableAutoConfiguration 
public class ConfigAppApplication extends  
    SpringBootServletInitializer { 

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

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

    @RestController 
    class ConfigController { 

    @RequestMapping("/hello") 
    public String hello() { 
     return "hello world"; 
    } 
} 

私はそれを$ JBOSS_HOME/standalone/deploymentsにデプロイし、デプロイされていることを伝えます。

15:51:12,008 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0016: Replaced deployment "config-app-0.0.1-SNAPSHOT.war" with deployment "config-app-0.0.1-SNAPSHOT.war" 

と私はマーカーファイルを取得:

config-app-0.0.1-SNAPSHOT.war.deployed 

JMXコンソールは、アプリケーションがあまりにも有効になっていると言われますが。 エンドポイントにアクセスしようとすると、いつでもアクセスできます。ルートコンテキストにアクセスしようとすると403のアクセスが禁止されますが、残りのリソースにアクセスしようとすると、 localhost:8080/config-app/hello 404エラーが表示されます。

私が間違っていることは何ですか?

ありがとう

+0

ことはConfigAppApplication' 'の全体のソースですか?それは '@ SpringBootApplication'やそれに相当する別々のアノテーションがありません。 –

+0

アプリケーションサーバーにスタンドアロンのアプリケーションを展開することは意味がありません。 –

+0

@AndyWilkinson - 私は質問を編集しました。私は事故でそれを取り除いたと思うので、頭のおかげで感謝します。 – raghera

答えて

1

Wildflyはundertowサーブレットコンテナを使用します。アプリケーションのサポートを追加してみてください。

参考:73.13 Use Undertow instead of Tomcat

<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-web</artifactId> 
    <exclusions> 
     <exclusion> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-tomcat</artifactId> 
     </exclusion> 
    </exclusions> 
</dependency> 
<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-undertow</artifactId> 
</dependency> 
+0

私はそれを与えることができますが、WildflyはUndertowを提供しています...だから私は実行時にそのUndertowサーバーを使用したいと思うでしょう - 春のブートの依存関係ではありません。 – raghera

+0

ドキュメントを読んで、私は彼らがspringboot-undertowがundertowコンテナに単に接続すると言ったと思います。これは、一般的にspringbootサーブレットコンテナライブラリに当てはまると思います。 –

関連する問題