前提・実現したいこと
eclipseでspring bootの導入をしたい。
発生している問題・エラーメッセージ
spring bootで作成したサンプルプログラムを起動した際、サーバーが起動しない。
http://localhost:8080/webというURLにアクセスしたが、ローカルサーバーが立ってないため接続できない。
eclipse側のコンソールにエラーメッセージは表示されていない。
コンソールメッセージ . ____ _ __ _ _ /\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ / _` | \ \ \ \ \/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.5.10.RELEASE) 2018-02-11 12:20:26.926 INFO 8272 --- [ main] jp.co.sample.Sample2Application : Starting Sample2Application on YOLa14 with PID 8272 (C:\WorkSpace\sample2\target\classes started by YO in C:\WorkSpace\sample2) 2018-02-11 12:20:26.931 INFO 8272 --- [ main] jp.co.sample.Sample2Application : No active profile set, falling back to default profiles: default 2018-02-11 12:20:27.032 INFO 8272 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@429bd883: startup date [Sun Feb 11 12:20:27 JST 2018]; root of context hierarchy 2018-02-11 12:20:28.815 INFO 8272 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2018-02-11 12:20:28.843 INFO 8272 --- [ main] jp.co.sample.Sample2Application : Started Sample2Application in 2.475 seconds (JVM running for 9.185) hello() 2018-02-11 12:20:28.843 INFO 8272 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@429bd883: startup date [Sun Feb 11 12:20:27 JST 2018]; root of context hierarchy 2018-02-11 12:20:28.854 INFO 8272 --- [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
該当のソースコード
java
1package jp.co.sample; 2 3import org.springframework.boot.SpringApplication; 4import org.springframework.boot.autoconfigure.SpringBootApplication; 5import org.springframework.context.ConfigurableApplicationContext; 6 7@SpringBootApplication 8public class Sample2Application { 9 10 11 ConfigurableApplicationContext cac = SpringApplication.run(Sample2Application.class, args); 12 Sample2Application app = cac.getBean(Sample2Application.class); 13 app.hello(); 14 } 15 16 17 public void hello() { 18 System.out.println("hello()"); 19 } 20} 21
java
1package jp.co.sample; 2 3import org.springframework.web.bind.annotation.RequestMapping; 4import org.springframework.web.bind.annotation.RestController; 5 6@RestController 7public class WebController { 8 9 @RequestMapping("/web") 10 public String hello() { 11 return "hello()"; 12 } 13 14} 15
pom
xml
1<?xml version="1.0" encoding="UTF-8"?> 2<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4 <modelVersion>4.0.0</modelVersion> 5 6 <groupId>jp.co.ric.microservices</groupId> 7 <artifactId>weatherboot</artifactId> 8 <version>0.0.1-SNAPSHOT</version> 9 <packaging>jar</packaging> 10 11 <name>sample2</name> 12 <description>Demo project for Spring Boot</description> 13 14 <parent> 15 <groupId>org.springframework.boot</groupId> 16 <artifactId>spring-boot-starter-parent</artifactId> 17 <version>1.5.10.RELEASE</version> 18 <relativePath/> <!-- lookup parent from repository --> 19 </parent> 20 21 <properties> 22 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 23 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 24 <java.version>1.8</java.version> 25 </properties> 26 27 <dependencies> 28 <dependency> 29 <groupId>org.springframework.boot</groupId> 30 <artifactId>spring-boot-starter-web</artifactId> 31 </dependency> 32 33 <dependency> 34 <groupId>org.springframework.boot</groupId> 35 <artifactId>spring-boot-starter-test</artifactId> 36 <scope>test</scope> 37 </dependency> 38 </dependencies> 39 40 <build> 41 <plugins> 42 <plugin> 43 <groupId>org.springframework.boot</groupId> 44 <artifactId>spring-boot-maven-plugin</artifactId> 45 </plugin> 46 </plugins> 47 </build> 48 49 50</project>
試したこと
[spring boot 入門]という検索キーワードで、環境構築方法を調べたが、問題解決方法がみつからなかった。
[spring boot サーバー 起動しない]というキーワード検索でも、同様の症状はみつからなかった。
補足情報(FW/ツールのバージョンなど)
pleiades 4.6.2 64bit java fullversion
Springプラグイン3.8.3

下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
また依頼した内容が修正された場合は、修正依頼を取り消すようにしましょう。
退会済みユーザー
2018/02/20 09:38