microsoft / microsoft/vscode-java-test
NoClassDefFoundError when running test in project with classifiers
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 340
- Forks
- 173
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 18
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure in the described two-project workspace, then inspect Project A in Java Dependency Viewer while Project B is present or removed. Done means Project B remains in Maven Dependencies and Project A's unit test runs without the NoClassDefFoundError; the issue names no repository files or tests to inspect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, vscode
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100