0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

TomcatをVSCode上で起動させる

0
Posted at

背景

SpringBootを使ってWebアプリケーションの個人開発をしていて、VSCodeからアプリを起動して動作確認をしたくなった。Tomcat for Javaが非推奨だったのでCommunity Server Connectorsを導入した。
以下、参考記事の手順に沿って導入した。

参考記事

  1. VSCode拡張機能Community Server Connectorsを試して、sample.warをデプロイしてみた
  2. WindowsへのMavenインストール

実際に行った手順

拡張機能や必要なツールのインストール

  1. 読んでCommunity Server Connectors拡張機能をインストール
  2. 同様に、Mavenをインストール(参考記事2の手順)
  3. 参考記事1に戻ってCommunity Server Connectorsのセットアップ。以下コマンドを実行して導入しようとしたところ、mvn clean installでエラー発生

実行したコマンド

git clone https://github.com/redhat-developer/rsp-server-community
cd rsp-server-community/rsp
mvn clean install

エラー発生時のログ

 Failed to resolve target definition H:\rsp-server-community\rsp\targetplatform\rsp-community-target.target: Failed to load p2 metadata repository from location http://download.jboss.org/jbosstools/updates/requirements/simrel/20190301-0700-Simrel.2019-03.M3/: Unable to read repository at file:/C:/Users/ユーザ名/.m2/repository/.cache/tycho/p2-repository-metadata/content-1613736570.jar. JAXP00010003: エンティティ"[xml]"の長さは"100,001"で、"jdk.xml.maxGeneralEntitySizeLimit"で設定された制限"100,000"を超えています。 -> [Help 1]

どうやらxmlに設定されているjdkでの制限に引っかかっているらしい。

参考までにJavaとMavenのバージョン情報

PS H:\rsp-server-community\rsp> java -version
java version "25.0.1" 2025-10-21 LTS
Java(TM) SE Runtime Environment (build 25.0.1+8-LTS-27)
Java HotSpot(TM) 64-Bit Server VM (build 25.0.1+8-LTS-27, mixed mode, sharing)
PS H:\rsp-server-community\rsp> mvn --v
Apache Maven 3.9.16 (2bdd9fddda4b155ebf8000e807eb73fd829a51d5)
Maven home: C:\apache-maven-3.9.16
Java version: 25.0.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-25
Default locale: ja_JP, platform encoding: UTF-8
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

JDK24-26を使用していると遭遇しやすいらしい。
(https://github.com/eclipse-tycho/tycho/issues/4526)
新しいJDKの組み合わせによるXML解析制限の問題の可能性が高い。

  • 対処法:Maven起動時に制限を無効化
set MAVEN_OPTS=-Djdk.xml.maxGeneralEntitySizeLimit=0 -Djdk.xml.totalEntitySizeLimit=0

mvn clean install

上記コマンドを実行後、ビルド成功

スクリーンショット 2026-07-18 194217.png

再度アプリケーションのソースコードをVSCodeで開くと、Server Community Connectorsが選択できるようになる
スクリーンショット 2026-07-18 194459.png

サーバーの追加・起動確認

  1. Tomocatの追加
    Server→Community Server Connectorsを右クリック→Create New Server
    →command center(上の検索バー)に選択肢が出るのでYesをクリック
    追加するサーバを選ぶ。(今回はTomcat11.0.0-M6)→Continue

    Community Server ConnectorsにTomcatが追加された
    スクリーンショット 2026-07-18 195629.png

  2. Server起動 表示されたapache-tomcat-11.0.0-M6を右クリック→ Start Serverをクリック
    起動ログが表示される

ブラウザでhttp//localhost:8080へアクセスすると でウェルカムページが表示される
スクリーンショット 2026-07-18 200204.png


開発したアプリのデプロイ編は後日記事にまとめます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?