microsoft / microsoft/vscode-java-test

NoClassDefFoundError when running test in project with classifiers

Aperta
#775 25 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

ai-triaged bug high-priority investigating junit maven test-execution upstream
Lingua principale
TypeScript
Stelle
340
Fork
173
Merge medio
1g 19h
PR unite (30g)
18

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci il problema nell’area di lavoro descritta con due progetti, quindi esamina Project A in Java Dependency Viewer mentre Project B è presente o rimosso. L’attività è completata quando Project B rimane in Maven Dependencies e il test unitario di Project A viene eseguito senza il NoClassDefFoundError; l’issue non indica file del repository o test da esaminare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java, vscode
Ambito
build-system, testing
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.