前提・実現したいこと
java Spring Bootにてポートフォリオ作成中の初心者です。
現在、"SpringBoot2"応用という書籍を参考に勉強中なのですが、
AWSへデプロイするところで詰まっております。
共通環境(jdbc:h2:mem:testdb)では問題なくデプロイできているのですが、
次のステップの、データベースをMySQLへ切り替えるところでコンソールにERRORが
発生してしまいます。
(メニューの「実行横の▼」をクリック。「m2 アプリ名」を選択すると、ビルドが始まりjarファイルが作成)←を実行するとコンソールにエラー。
エラーが発生していますが、そのまま書籍通りに進めて「アップロードとデプロイ」ボタンを押すと
一応ヘルスOK画面が出てアプリを表示できています。
ですがエラーが出ているのにデータベースがMySQLに本当に切り替わっているのか疑問です。
どなたか解られる方がいらっしゃいましたらご教授よろしくお願いいたします。
発生している問題・エラーメッセージ
. ____ _ __ _ _ /\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ / _` | \ \ \ \ \/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.5.6) 2021-11-01 13:29:40.914 INFO 1227 --- [ main] c.b.EveryoneNoteApplicationTests : Starting EveryoneNoteApplicationTests using Java 16.0.2 on tanakakennoMacBook-Pro.local with PID 1227 (started by tanakaken in /Users/tanakaken/Desktop/appBox/Note-master/Desktop/MyWebApplication/EveryoneNote) 2021-11-01 13:29:40.919 INFO 1227 --- [ main] c.b.EveryoneNoteApplicationTests : No active profile set, falling back to default profiles: default 2021-11-01 13:29:41.753 INFO 1227 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2021-11-01 13:29:41.764 INFO 1227 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 4 ms. Found 0 JPA repository interfaces. 2021-11-01 13:29:42.102 INFO 1227 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2021-11-01 13:29:42.248 INFO 1227 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2021-11-01 13:29:42.379 INFO 1227 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2021-11-01 13:29:42.426 INFO 1227 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.32.Final 2021-11-01 13:29:42.552 INFO 1227 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} 2021-11-01 13:29:42.678 INFO 1227 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect 2021-11-01 13:29:42.871 INFO 1227 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2021-11-01 13:29:42.878 INFO 1227 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2021-11-01 13:29:43.282 WARN 1227 --- [ main] 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 2021-11-01 13:29:44.357 INFO 1227 --- [ main] c.b.EveryoneNoteApplicationTests : Started EveryoneNoteApplicationTests in 8.742 seconds (JVM running for 9.578) [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 9.331 s - in com.beit_and_pear.EveryoneNoteApplicationTests 2021-11-01 13:29:44.630 INFO 1227 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2021-11-01 13:29:44.631 INFO 1227 --- [ionShutdownHook] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down' 2021-11-01 13:29:44.633 INFO 1227 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2021-11-01 13:29:44.636 INFO 1227 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. [INFO] [INFO] Results: [INFO] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] [INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ EveryoneNote --- [INFO] Building jar: /Users/tanakaken/Desktop/appBox/Note-master/Desktop/MyWebApplication/EveryoneNote/target/EveryoneNote-1.0.0.jar [INFO] [INFO] --- spring-boot-maven-plugin:2.5.6:repackage (repackage) @ EveryoneNote --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 12.191 s [INFO] Finished at: 2021-11-01T13:29:45+09:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.5.6:repackage (repackage) on project EveryoneNote: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.5.6:repackage failed: Unable to find a single main class from the following candidates [com.beit_and_pear.EveryoneNoteApplication 2, com.beit_and_pear.EveryoneNoteApplication] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
該当のソースコード
application.yml # 共通環境 spring: datasource: url: jdbc:h2:mem:testdb mybatis: configuration: map-underscore-to-camel-case: true type-aliases-package: com.beit_and_pear.model server: port: 5000 --- # 開発環境(dev) spring: config: activate: on-profile: - dev datasource: url: jdbc:mysql://確認したエンドポイント/ebdb username: admin password: password sql: init: mode: always
試したこと
ymlではなくapplication.propertiesでも同じ結果でした。
RDS停止後のエラーメッセージ
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. [2m2021-11-02 18:52:03.702[0;39m [31mERROR[0;39m [35m2164[0;39m [2m---[0;39m [2m[ restartedMain][0;39m [36mo.s.b.d.LoggingFailureAnalysisReporter [0;39m [2m:[0;39m *************************** APPLICATION FAILED TO START *************************** Description: Web server failed to start. Port 5000 was already in use. Action: Identify and stop the process that's listening on port 5000 or configure this application to listen on another port.
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/11/02 09:55