redhat-developer / redhat-developer/vscode-java

failed to run samples/webflux-websocket under Spring GraphQL project

Ouverte
#2,504 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

bug compile Gradle
Langage dominant
TypeScript
Étoiles
2.3k
Forks
546
Merge moyen
20 h 1 min
PR mergées (30 j)
11

Description

See https://github.com/spring-projects/spring-graphql/issues/408 - Thought it's a Spring GraphQL problem, but turns out to be a VSCode Java problem. Running the sample project in command prompt works fine.

Environment
  • Operating System: Debian (WSL)
  • JDK version: JDK17
  • Visual Studio Code version:
Version: 1.68.0 (user setup)
Commit: 4af164ea3a06f701fe3e89a2bcbb421d2026b68f
Date: 2022-06-08T11:44:16.822Z
Electron: 17.4.7
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Windows_NT x64 10.0.19044
  • Java extension version: v0.23.0
Steps To Reproduce

Steps:

$ git clone git@github.com:spring-projects/spring-graphql.git
Cloning into 'spring-graphql'...
remote: Enumerating objects: 13481, done.
remote: Counting objects: 100% (2931/2931), done.
remote: Compressing objects: 100% (669/669), done.
remote: Total 13481 (delta 2257), reused 2461 (delta 2113), pack-reused 10550
Receiving objects: 100% (13481/13481), 2.23 MiB | 1.13 MiB/s, done.
Resolving deltas: 100% (5538/5538), done.

$ cd spring-graphql/samples/webflux-websocket/

$ code .  # launch VSCode which has Extension Pack for Java installed

Wait for Java Build to complete (watch Java Build Status):

f2f77ace Creating link. [Done]
7cc72c43 Repository registry initialization [Done]
c5b2cd49 Refreshing Maven model [Done]
336d8b3f Refreshing workspace [Done]
0bf7ffd0 Building [Done]

Go to JAVA PROJECTS and click [Debug] Icon:

image

Then got results:

 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v2.7.0-SNAPSHOT)

2022-06-10 10:58:50.883  INFO 10045 --- [  restartedMain] i.s.sample.graphql.SampleApplication     : Starting SampleApplication using Java 1.8.0_311 on powerberry with PID 10045 (/home/tigerinus/dev/tigerinus/spring-graphql/samples/webflux-websocket/bin/main started by tigerinus in /home/tigerinus/dev/tigerinus/spring-graphql/samples/webflux-websocket)
2022-06-10 10:58:50.885  INFO 10045 --- [  restartedMain] i.s.sample.graphql.SampleApplication     : No active profile set, falling back to 1 default profile: "default"
2022-06-10 10:58:50.957  INFO 10045 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2022-06-10 10:58:50.959  INFO 10045 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2022-06-10 10:58:52.103 DEBUG 10045 --- [  restartedMain] reactor.netty.tcp.TcpResources           : [http] resources will use the default LoopResources: DefaultLoopResources {prefix=reactor-http, daemon=true, selectCount=4, workerCount=4}
2022-06-10 10:58:52.104 DEBUG 10045 --- [  restartedMain] reactor.netty.tcp.TcpResources           : [http] resources will use the default ConnectionProvider: reactor.netty.resources.DefaultPooledConnectionProvider@12e972e3
2022-06-10 10:58:52.586 DEBUG 10045 --- [  restartedMain] o.s.w.r.handler.SimpleUrlHandlerMapping  : Patterns [/webjars/**, /**] in 'resourceHandlerMapping'
2022-06-10 10:58:52.946  INFO 10045 --- [  restartedMain] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 3 endpoint(s) beneath base path '/actuator'
2022-06-10 10:58:53.118 DEBUG 10045 --- [  restartedMain] o.s.w.r.r.m.a.ControllerMethodResolver   : ControllerAdvice beans: none
2022-06-10 10:58:53.161 DEBUG 10045 --- [  restartedMain] o.s.w.s.adapter.HttpWebHandlerAdapter    : enableLoggingRequestDetails='false': form data and headers will be masked to prevent unsafe logging of potentially sensitive data
2022-06-10 10:58:53.612  WARN 10045 --- [  restartedMain] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'graphQlSource' defined in class path resource [org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.graphql.execution.GraphQlSource]: Factory method 'graphQlSource' threw exception; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy86 cannot be cast to org.springframework.graphql.data.method.annotation.BatchMapping
2022-06-10 10:58:53.645  INFO 10045 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-06-10 10:58:53.671 ERROR 10045 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'graphQlSource' defined in class path resource [org/springframework/boot/autoconfigure/graphql/GraphQlAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.graphql.execution.GraphQlSource]: Factory method 'graphQlSource' threw exception; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy86 cannot be cast to org.springframework.graphql.data.method.annotation.BatchMapping

If I do

$ cd spring-graphql/samples/webflux-websocket/
$ ../../gradlew bootRun

... then everything works fine.

So it's something related to VSCode Java support.

I tried both JDK17 and JDK8 in VSCode and got the same error.
I tried both JDK17 and JDK8 in command line and they are working fine.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Reproduisez l’échec de samples/webflux-websocket en l’ouvrant dans VS Code et en utilisant l’action Java Projects Debug, puis comparez-le avec ../../gradlew bootRun. Étudiez le chemin de prise en charge de Java dans VS Code qui produit la ClassCastException ; le travail est terminé lorsque l’exemple démarre correctement via VS Code, comme depuis la ligne de commande.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java, spring-boot, typescript, vscode
Domaine
developer-experience, tooling
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.