Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket subscription with Webflux #1596

Open
rhdeandrade opened this issue Aug 4, 2023 · 2 comments
Open

Websocket subscription with Webflux #1596

rhdeandrade opened this issue Aug 4, 2023 · 2 comments
Assignees

Comments

@rhdeandrade
Copy link

rhdeandrade commented Aug 4, 2023

Hi, I've been trying to implement Subscriptions in our project with Websocket and Webflux, however I'm getting an error and as per documentation and other questions I've read it should work.

I'm using the following dependencies on my project:

 <dependency>
			<groupId>com.netflix.graphql.dgs</groupId>
			<artifactId>graphql-dgs-webflux-starter</artifactId>
		</dependency>

		<dependency>
			<groupId>com.netflix.graphql.dgs</groupId>
			<artifactId>graphql-dgs-subscriptions-websockets-autoconfigure</artifactId>
		</dependency>

		<dependency>
			<groupId>com.netflix.graphql.dgs</groupId>
			<artifactId>graphql-dgs-spring-webflux-autoconfigure</artifactId>
		</dependency>

But I'm still getting this error:

Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.HandlerMapping at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[na:na]

I'm on version:

5.5.0

@congotej
Copy link
Contributor

congotej commented Aug 9, 2023

Hi @rhdeandrade! The error message you've shared indicates that the class org.springframework.web.servlet.HandlerMapping is not found in the classpath. This typically suggests that there might be a compatibility issue between the Spring modules you're using and the version of Spring Boot you're on. It looks like the graphql-dgs-webflux-starter dependency is trying to load a class from the Spring Web MVC module (spring-webmvc), which might not be compatible with the WebFlux setup you're using.

Could you please try making sure the Spring Boot version you're using is compatible with the Spring WebFlux setup and the DGS dependencies you have? You mentioned you are on DGS version 5.5.0, so you should be on Spring Boot 2.7.

If you don't find any version conflicts there, perhaps you could try excluding some of the transitive dependencies of graphql-dgs-webflux-starter that might be pulling in Spring Web MVC.

@congotej congotej self-assigned this Aug 9, 2023
@hantsy
Copy link
Contributor

hantsy commented Jan 24, 2024

Remove the following deps:

<dependency>
  <groupId>com.netflix.graphql.dgs</groupId>
  <artifactId>graphql-dgs-subscriptions-websockets-autoconfigure</artifactId>
</dependency>

<dependency>
  <groupId>com.netflix.graphql.dgs</groupId>
  <artifactId>graphql-dgs-spring-webflux-autoconfigure</artifactId>
</dependency>

The graphql-dgs-subscriptions-websockets-autoconfigure is for webmvc stack, and webflux starter includes graphql-dgs-spring-webflux-autoconfigure as transitive dep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants