microsoft / microsoft/vscode-java-test

NoClassDefFoundError when running test in project with classifiers

Đang mở
#775 25 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

ai-triaged bug high-priority investigating junit maven test-execution upstream
Ngôn ngữ chính
TypeScript
Star
340
Fork
173
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
18

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện lỗi trong workspace gồm hai project được mô tả, sau đó kiểm tra Project A trong Java Dependency Viewer khi Project B đang hiện diện hoặc đã bị xóa. Được xem là hoàn tất khi Project B vẫn còn trong Maven Dependencies và unit test của Project A chạy mà không gặp NoClassDefFoundError; issue không nêu tên file repository hay test nào cần kiểm tra.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java, vscode
Lĩnh vực
build-system, testing
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.