MacでSTSをダウンロードし、webアプリケーションの開発を開始しようとしたところで躓いています。ブラウザでローカルホストに接続しようとしたところ、「localhostを待機しています...」というメッセージが画面左下に表示されたまま、ローディング状態が続いてしまい困っています。(クロームのタブアイコンもグルグル回ったままになります)
プロジェクトを作成するまでは以下の手順で作業を進めました。
1.「新規」→「スプリングスタータープロジェクトを作成」を選択してプロジェクトを作成
2.依存関係の追加は
WebSocket SpringBootDevTool H2Database SpringDataJPA Thymeleaf の合計5つを選択。
3.初回起動のために
・Maven設定のゴール→packageを設定
・その後プロジェクトを起動
4.controllerとview(hello.html)を作成し、localhost:8080/helloにアクセス
という流れで作業しましたが、ローカルホストへの接続が上手くいかない状況です。
作成したcontrollerとViewのソースは以下の通りです。
MainController.java
package com.example.demo.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; @Controller public class MainController { @GetMapping("/hello") public ModelAndView goHello(ModelAndView mav) { mav.setViewName("hello"); return mav; } }
hello.html
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Hello Page</title> </head> <body> <h1>Hello</h1> </body> </html>
コンソール出力
. ____ _ __ _ _ /\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ / _` | \ \ \ \ \/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.3.2.RELEASE) 2020-08-16 02:22:46.416 INFO 54694 --- [ restartedMain] com.example.demo.DemoApplication : Starting DemoApplication on MacBook-Pro-103.local with PID 54694 (/Users/teruhisashibuya/Documents/workspace-spring-tool-suite-4-4.7.1.RELEASE/demo/target/classes started by teruhisashibuya in /Users/teruhisashibuya/Documents/workspace-spring-tool-suite-4-4.7.1.RELEASE/demo) 2020-08-16 02:22:46.417 INFO 54694 --- [ restartedMain] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default 2020-08-16 02:22:46.452 INFO 54694 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable 2020-08-16 02:22:46.453 INFO 54694 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG' 2020-08-16 02:22:46.933 INFO 54694 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode. 2020-08-16 02:22:46.953 INFO 54694 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 9ms. Found 0 JPA repository interfaces. 2020-08-16 02:22:47.375 INFO 54694 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2020-08-16 02:22:47.384 INFO 54694 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2020-08-16 02:22:47.384 INFO 54694 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37] 2020-08-16 02:22:47.462 INFO 54694 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2020-08-16 02:22:47.462 INFO 54694 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1009 ms 2020-08-16 02:22:47.489 INFO 54694 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2020-08-16 02:22:47.591 INFO 54694 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2020-08-16 02:22:47.596 INFO 54694 --- [ restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:b17b2c5f-c0d7-46d1-91fc-ed7d49959453' 2020-08-16 02:22:47.708 INFO 54694 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2020-08-16 02:22:47.746 INFO 54694 --- [ task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2020-08-16 02:22:47.768 WARN 54694 --- [ restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 2020-08-16 02:22:47.784 INFO 54694 --- [ task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.18.Final 2020-08-16 02:22:47.886 INFO 54694 --- [ task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final} 2020-08-16 02:22:47.962 INFO 54694 --- [ task-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect 2020-08-16 02:22:48.042 INFO 54694 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2020-08-16 02:22:48.093 INFO 54694 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2020-08-16 02:22:48.095 INFO 54694 --- [ restartedMain] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories… 2020-08-16 02:22:48.095 INFO 54694 --- [ restartedMain] DeferredRepositoryInitializationListener : Spring Data repositories initialized! 2020-08-16 02:22:48.104 INFO 54694 --- [ restartedMain] com.example.demo.DemoApplication : Started DemoApplication in 1.903 seconds (JVM running for 2.543) 2020-08-16 02:22:48.109 INFO 54694 --- [ task-1] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2020-08-16 02:22:48.115 INFO 54694 --- [ task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' コード
念の為グーグルクロームとサファリの両環境で動作を確認しましたが、両方において同じ現象が起きています。
VisualStudioCodeでもSpringBootパッケージを利用して同じ状況を作りましたが、同様の状況です。
原因をご存知の方がいらしゃいましたら、ご指導頂けますと幸いです。
よろしくお願い致します。
〜各種バージョン情報〜
Mac Version
macOS Mojave
バージョン 10.14.6
Spring Version
Spring Tool Suite 4
Version: 4.7.1.RELEASE
Build Id: 202007271558
JDK バージョン
AMAZON-Corretto-11.0.3.7.1
回答1件
あなたの回答
tips
プレビュー