2017-12-07 18 views
0

私は春のブートプロジェクトの実行に問題があります。実行に失敗しました。エラー表示:その前に組み込みコンテナの春の起動を開始できません

2017-12-07 13:55:54.639 INFO 8624 --- [   main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.spring[email protected]2a5c8d3f: startup date [Thu Dec 07 13:55:54 ICT 2017]; root of context hierarchy 
2017-12-07 13:55:54.842 INFO 8624 --- [   main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 
2017-12-07 13:55:54.881 INFO 8624 --- [   main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$f3f6c3e5] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 

    . ____   _   __ _ _ 
/\\/___'_ __ _ _(_)_ __ __ _ \ \ \ \ 
(()\___ | '_ | '_| | '_ \/ _` | \ \ \ \ 
\\/ ___)| |_)| | | | | || (_| | )))) 
    ' |____| .__|_| |_|_| |_\__, |//// 
=========|_|==============|___/=/_/_/_/ 
:: Spring Boot ::  (v1.5.6.RELEASE) 

2017-12-07 13:55:55.240 INFO 8624 --- [   main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888 
2017-12-07 13:55:56.317 WARN 8624 --- [   main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/hpx-delivery-report/default": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect 
2017-12-07 13:55:56.318 INFO 8624 --- [   main] c.p.i.m.s.b.uniqueid.EPolicyApplication : No active profile set, falling back to default profiles: default 
2017-12-07 13:55:56.327 INFO 8624 --- [   main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot[email protected]3dd1dc90: startup date [Thu Dec 07 13:55:56 ICT 2017]; parent: org.spring[email protected]2a5c8d3f 
2017-12-07 13:55:57.518 INFO 8624 --- [   main] o.s.cloud.context.scope.GenericScope  : BeanFactory id=781352cf-bed8-31d9-a952-be1fa48d68a0 
2017-12-07 13:55:57.537 INFO 8624 --- [   main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 
2017-12-07 13:55:57.635 INFO 8624 --- [   main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$d7dcc0e8] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2017-12-07 13:55:57.671 INFO 8624 --- [   main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$f3f6c3e5] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 
2017-12-07 13:55:57.676 WARN 8624 --- [   main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean. 
2017-12-07 13:55:57.683 INFO 8624 --- [   main] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 
2017-12-07 13:55:57.690 ERROR 8624 --- [   main] o.s.boot.SpringApplication    : Application startup failed 

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean. 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] 
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] 
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] 
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] 
    at com.prudential.integration.middleware.spring.boot.uniqueid.EPolicyApplication.main(EPolicyApplication.java:10) [classes/:na] 
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean. 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:189) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:162) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] 
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE] 
    ... 8 common frames omitted 

は、私がjavax.servlet.api依存関係を持っているが、私は、これは問題だと思うので、私は依存関係のことを除去するが、私は春のブートプロジェクトを実行しようとすると、やはり失敗しました。私もstarter風の依存関係は除外しましたが、まだ失敗しました。私もstackoverflowで同じ問題の解決策を参照してくださいしかし、私は解決策を見つけることができません。

私のpom.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>com.prudential.integration.middleware.spring.boot</groupId> 
    <artifactId>hpx-aws-letter-unique-id</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>war</packaging> 

    <name>hpx-aws-letter-unique-id</name> 
    <description>Hpx Aws Letter Unique Id Service Spring Boot</description> 
    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.5.6.RELEASE</version> 
     <relativePath /> <!-- lookup parent from repository --> 
    </parent> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
     <java.version>1.8</java.version> 
     <swagger.version>2.7.0</swagger.version> 
     <jboss.home>${env.JBOSS_HOME}</jboss.home> 
     <config.server>http://10.170.49.103/configserver</config.server> 
     <spring-cloud.version>1.3.2.RELEASE</spring-cloud.version> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-data-jpa</artifactId> 
     </dependency> 
     <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-test</artifactId> 
      <scope>test</scope> 
     </dependency> 

     <!-- QueryDSL --> 
     <dependency> 
      <groupId>com.querydsl</groupId> 
      <artifactId>querydsl-core</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>com.querydsl</groupId> 
      <artifactId>querydsl-apt</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>com.querydsl</groupId> 
      <artifactId>querydsl-jpa</artifactId> 
     </dependency> 

     <!-- Swagger --> 
     <dependency> 
      <groupId>io.springfox</groupId> 
      <artifactId>springfox-swagger2</artifactId> 
      <version>${swagger.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>io.springfox</groupId> 
      <artifactId>springfox-swagger-ui</artifactId> 
      <version>${swagger.version}</version> 
     </dependency> 

     <dependency> 
      <groupId>org.postgresql</groupId> 
      <artifactId>postgresql</artifactId> 
      <scope>runtime</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.github.jmnarloch</groupId> 
      <artifactId>modelmapper-spring-boot-starter</artifactId> 
      <version>1.1.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.poi</groupId> 
      <artifactId>poi-ooxml</artifactId> 
      <version>3.15</version> 
     </dependency> 
     <dependency> 
      <groupId>net.sourceforge.jexcelapi</groupId> 
      <artifactId>jxl</artifactId> 
      <version>2.6.12</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.commons</groupId> 
      <artifactId>commons-lang3</artifactId> 
      <version>3.6</version> 
     </dependency> 


     <dependency> 
      <groupId>com.jcraft</groupId> 
      <artifactId>jsch</artifactId> 
      <version>0.1.54</version> 
     </dependency> 

     <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient --> 
    <dependency> 
     <groupId>org.apache.httpcomponents</groupId> 
     <artifactId>httpclient</artifactId> 
     <version>4.5.3</version> 
    </dependency> 

    <dependency> 
    <groupId>org.json</groupId> 
     <artifactId>json</artifactId> 
     <version>20171018</version> 
    </dependency> 

     <dependency> 
      <groupId>commons-codec</groupId> 
      <artifactId>commons-codec</artifactId> 
      <version>1.9</version> 
     </dependency> 
    </dependencies> 

    <build> 
     <finalName>${project.name}-${project.version}</finalName> 
     <plugins> 

      <!-- JBOSS maven plugin to simulate deployment to JBOSS --> 
      <plugin> 
       <groupId>org.jboss.as.plugins</groupId> 
       <artifactId>jboss-as-maven-plugin</artifactId> 
       <version>7.9.Final</version> 
       <configuration> 
        <jbossHome>${jboss.home}</jbossHome> 
        <serverArgs> 
         <serverArg>-Dspring.profiles.active=${run.profiles}</serverArg> 
         <serverArg>-Dspring.cloud.config.uri=${config.server}</serverArg> 
        </serverArgs> 
       </configuration> 
      </plugin> 

      <!-- QueryDSL Generator --> 
      <plugin> 
       <groupId>com.mysema.maven</groupId> 
       <artifactId>apt-maven-plugin</artifactId> 
       <version>1.1.3</version> 
      </plugin> 

      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <configuration> 
        <skipTests>true</skipTests> 
       </configuration> 
      </plugin> 
     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId> 
      <version>1.5.9.RELEASE</version> 
      <executions> 
       <execution> 
        <goals> 
         <goal>repackage</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin>    
     </plugins> 
    </build> 
</project> 

私のコントローラ:

@RestController 
@RequestMapping("/hpx") 
@Api(value="hpx", description="HPX Web Service") 
public class HPXController { 

    final static Logger logger = Logger.getLogger(HPXController.class); 

    @RequestMapping(value = "/testing", method = RequestMethod.POST) 
    public String tesMethod(){ 
     return "testing method"; 
    } 
} 

私の設定:

@SpringBootApplication 
public class EPolicyApplication { 

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

サーブレット:

public class ServletInitializer extends SpringBootServletInitializer { 

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

} 
+0

投稿にコードを追加してください –

+0

大丈夫Javaコード –

+0

を追加しました。ご質問でご提供いただいたPOMによると、** tomcatは除外されています(spring-boot-starter-tomcatの場合はを参照)。 -starter-web)。私がjboss eapに戦争して展開するためにそのプロジェクトを構築したいからです。 – glytching

答えて

1

mvn spring-boot:runを使って実行するには、spring boot maven pluginが必要です。以下のプラグインをpom.xmlに追加してください。

<plugin> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-maven-plugin</artifactId> 
     <version>1.5.9.RELEASE</version> 
     <executions> 
     <execution> 
      <goals> 
      <goal>repackage</goal> 
      </goals> 
     </execution> 
     </executions> 
</plugin> 

また、戦闘で追加されないように、tomcatの依存関係を設定します。

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

要件に応じて目標を変更したり、削除したりすることができます。 次に、組み込みのTomcatを使用して、上記のコマンドでアプリケーションをテストします。それを外部のアプリケーションサーバーに展開するには、そのアプリケーションをwarとしてパッケージ化し、Appサーバーの特定のディレクトリ(Jboss EAPなど)にコピーする必要があります。

+0

私はすでに追加しましたが、まだ失敗しました。 –

+0

編集内容を確認してください。 –

+0

がまだ失敗しました。私はすでに依存関係を追加しています。:( –

関連する問題