#Exception in thread "main" java.lang.NoClassDefFoundError: reactor/core/publisher/SynchronousSink

13 messages · Page 1 of 1 (latest)

native lodge
#

I don’t know what the error is, I think that Java or Gradle versions are not supported, but I didn’t find which versions I need anywhere

java 19
gradle 8.0
public static void main(String[] args) {
        Flux.generate(synchronousSink -> {
            synchronousSink.next("Hello");
        }).take(10).subscribe(System.out::println);
    }
plush steppeBOT
#

This post has been reserved for your question.

Hey @native lodge! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

keen solar
#

shaded it?

native lodge
keen solar
#

that error states that that class is not on your classpath

#

so only available at compile time

#

so you need to include that dependency in your jar file

#

chatgpt is telling me you need to use shadowJar for gradle but im not really a gradle expert sorry

radiant gorge
#

see if you are able to find reactor/core/publisher/SynchronousSink in your generated jar file

#

open it using 7zip or something

keen solar
#
In Gradle, you can use the "shadow" plugin to create a shaded JAR that includes all of your project's dependencies.

To use the shadow plugin, you need to first add the following to your build.gradle file:

python
Copy code
plugins {
  id 'com.github.johnrengelman.shadow' version '7.1.0'
}
Next, you can configure the plugin by adding the following to your build.gradle file:

javascript
Copy code
shadowJar {
  // Set the name of the shaded JAR
  archiveName = 'my-app.jar'

  // Configure the shading rules
  relocate 'org.slf4j', 'myapp.shaded.org.slf4j'
  minimize()
}
In the above configuration, the relocate method specifies the package to be shaded, and the new package name for the shaded classes. The minimize method is used to remove unused classes from the shaded JAR.

Once the shadow plugin is configured, you can create the shaded JAR by running the shadowJar task:

bash
Copy code
./gradlew shadowJar
This will create a shaded JAR in the build/libs directory.```