質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Spring

Spring Framework は、Javaプラットフォーム向けのオープンソースアプリケーションフレームワークです。 Java Platform上に、 Web ベースのアプリケーションを設計するための拡張機能が数多く用意されています。

Q&A

0回答

2112閲覧

Springの実行の際に番号を変えてもポートの競合が起こる

Panukaru

総合スコア0

Spring

Spring Framework は、Javaプラットフォーム向けのオープンソースアプリケーションフレームワークです。 Java Platform上に、 Web ベースのアプリケーションを設計するための拡張機能が数多く用意されています。

0グッド

0クリップ

投稿2020/07/01 02:55

編集2020/07/01 04:07

前提・実現したいこと

私用のPCにSpringの環境構築を行っています。
テスト用に作ったクラスを実行しようとしたところポートの競合により実行できないというエラーが発生し、コマンドプロンプトで確認、現在は使用していないポートに変更しても同じエラーが発生する状態になっています。

発生している問題・エラーメッセージ

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2020-07-01 11:18:50.163 ERROR 14344 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter  : *************************** APPLICATION FAILED TO START *************************** Description: The Tomcat connector configured to listen on port 2345 failed to start. The port may already be in use or the connector may be misconfigured. Action: Verify the connector's configuration, identify and stop any process that's listening on port 2345, or configure this application to listen on another port. 2020-07-01 11:18:50.167  INFO 14344 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

該当のソースコード

pom.xml

1pom.xml 2 3<?xml version="1.0" encoding="UTF-8"?> 4<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 6 <modelVersion>4.0.0</modelVersion> 7 <parent> 8 <groupId>org.springframework.boot</groupId> 9 <artifactId>spring-boot-starter-parent</artifactId> 10 <version>2.1.2.RELEASE</version> 11 <relativePath/> <!-- lookup parent from repository --> 12 </parent> 13 14 <groupId>jp.co.sss.kadai1</groupId> 15 <artifactId>DBkadai-1</artifactId> 16 <version>0.0.1-SNAPSHOT</version> 17 <name>DBkadai-1</name> 18 <description>Demo project for Spring Boot</description> 19 20 <properties> 21 <java.version>1.8</java.version> 22 </properties> 23 24 <dependencies> 25 <dependency> 26 <groupId>org.springframework.boot</groupId> 27 <artifactId>spring-boot-starter-thymeleaf</artifactId> 28 </dependency> 29 <dependency> 30 <groupId>org.springframework.boot</groupId> 31 <artifactId>spring-boot-starter-web</artifactId> 32 </dependency> 33 34 <dependency> 35 <groupId>org.springframework.boot</groupId> 36 <artifactId>spring-boot-devtools</artifactId> 37 <scope>runtime</scope> 38 <optional>true</optional> 39 </dependency> 40 <dependency> 41 <groupId>org.springframework.boot</groupId> 42 <artifactId>spring-boot-starter-test</artifactId> 43 <scope>test</scope> 44 <exclusions> 45 <exclusion> 46 <groupId>org.junit.vintage</groupId> 47 <artifactId>junit-vintage-engine</artifactId> 48 </exclusion> 49 </exclusions> 50 </dependency> 51 </dependencies> 52 53 <build> 54 <plugins> 55 <plugin> 56 <groupId>org.springframework.boot</groupId> 57 <artifactId>spring-boot-maven-plugin</artifactId> 58 </plugin> 59 </plugins> 60 </build> 61 62</project> 63

application.properties

1application.properties 2 3server.servlet.context-path=/test 4server.port= 2345 5spring.thymeleaf.cache=false

試したこと

・application.propertiesのポート番号の変更。
・ポート番号の変更後の再ビルド。
・コマンドプロンプトを用いた競合が起きているポートのタスクの終了。
・タスクマネージャーで競合が起きているポートのタスクの終了。
・XAMPP及びJavaの再インストール。

補足情報(FW/ツールのバージョンなど)

・Spring Boot 2.1.2
・Eclipse 4.13.0
・OS Windows10
・セキュリティソフト Avast Antivirus
よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

m.ts10806

2020/07/01 03:07

ポート変更後、ビルドしなおしましたか?
Panukaru

2020/07/01 03:24

返信ありがとうございます。 ビルドを行ったところ下記のエラーが発生し、Maven ビルドが実行できない状態でした。 (プロパティーのアクティブMavenプロファイルを空白にしても下記のエラーが発生しました。) [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.036 s [INFO] Finished at: 2020-07-01T12:19:59+09:00 [INFO] ------------------------------------------------------------------------ [WARNING] The requested profile "pom.xml" could not be activated because it does not exist. [ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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/NoGoalSpecifiedException
退会済みユーザー

退会済みユーザー

2020/07/01 03:35

30000 ~ にしてみたら
退会済みユーザー

退会済みユーザー

2020/07/01 03:48

上記で解決しない場合は ・STS 2.1.2 ⇒ Spring Boot のバージョンでは? STS のバージョンなら古すぎます。 現時点でリリースされてる安定板は 4.x です。 ・XAMPP 7.4.7 ⇒ おそらく同梱のMySQLを利用してるのだとは思いますがその場合は MySQL 5.7 みたいな記述に変更したほうがいいかと思うが今回は関係ないですよね。 ・Tomcat 7.0 ⇒ Spring Boot を利用しているなら 組み込み TOMCAT (たしか 9.0 )なので不要 ・OS が問題になる場合があるので 記載 ・セキュリティソフトが問題になる場合があるので記載
Panukaru

2020/07/01 03:57

返信ありがとうございます。上記のポート番号の変更し実行してみましたが結果は変わりませんでした。教えていただいた記述、追記してみます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問