microsoft / microsoft/vscode-java-test

NoClassDefFoundError when running test in project with classifiers

オープン
#775 コメント 25 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

ai-triaged bug high-priority investigating junit maven test-execution upstream
主要言語
TypeScript
スター
340
フォーク
173
平均マージ
1日 19時間
マージ済み PR(30日)
18

説明

VSCode version: 1.37.0
Java Test Runner version: 0.19.0

The workspace contains two projects, i.e. A and B. Project A depends on Project B.

When executing an unit test of Project A, the test failed due to a missing Java class definition from Project B.

Caused by: java.lang.NoClassDefFoundError: a/b/c/d/e/exception/InvalidTokenException
	at a.b.c.d.f.g.registrationService(g.java:27)
	at a.b.c.d.f.g$$EnhancerBySpringCGLIB$$db27a38.CGLIB$registrationService$0(<generated>)
	at a.b.c.d.f.g$$EnhancerBySpringCGLIB$$db27a38$$FastClassBySpringCGLIB$$df65555.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:355)
	at a.b.be.d.f.g$$EnhancerBySpringCGLIB$$db27a38.registrationService(<generated>)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
	... 39 more
Caused by: java.lang.ClassNotFoundException: a.b.c.d.e.exception.InvalidTokenException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 50 more

When browsing the dependency of Project A using Java Dependency Viewer, Project B is missing from Maven Dependencies.

If I remove Project B from the workspace, Project B re-appears in the dependency list under Maven Dependencies. At this moment, the test runs perfectly fine without any issue.

I am not sure whether there are some issues on resolving classpath in mutli-project workspace.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

説明されている2プロジェクトのワークスペースで失敗を再現し、その後、Project B が存在する状態または削除された状態で、Java Dependency Viewer で Project A を調査します。Project B が Maven Dependencies に残り、Project A の単体テストが NoClassDefFoundError なしで実行されれば完了です。issue には調査対象のリポジトリファイルやテストは記載されていません。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, vscode
領域
build-system, testing
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。