OS: Ubuntu 22.04.1 LTS
java: openjdk-18.0.2.1
I got the folowing error when trying to connect to a MongoDB database from ReactiveMongo API (reactivemongo_3-1.1.0-noshaded-RC6):
java.lang.NoClassDefFoundError: reactivemongo/core/errors/ConnectionException
Exception in thread "main" java.lang.NoClassDefFoundError: reactivemongo/core/errors/ConnectionException
at reactivemongo.api.AsyncDriver$.apply(AsyncDriver.scala:503)
at e2m.MongoExport.<init>(MongoExport.scala:35)
at e2m.MongoExport$.<clinit>(MongoExport.scala:82)
at e2m.MongoExport.main(MongoExport.scala)
Caused by: java.lang.ClassNotFoundException: reactivemongo.core.errors.ConnectionException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 4 more
I looked for the package "reactivemongo.core.errors" inside the jar file and I did not found it.
Could you help me out by telling me which jar file should I include in my project to solve this problem?
Thanks
Related
Everything works fine when debugging the project on the intelij environment.
But when I try to execute
java -jar myJar.jar
I get
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/support/ui/Wait
at com.anyclip.App.main(App.java:43)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.support.ui.Wait
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 1 more
I tried several solutions, including this one (ClassNotFoundException on a Maven Project using Selenium), but all failed.
How can I overcome this?
I am new to Java and trying around. Now I would like to learn about network - server client communications. Long story short I found jars on github which should make the start easier. So I downloaded the file and added it to my Modulepath. Everything looked OK while writing a simple start to just connect but when I want to run for testing I get the NoClassDefFoundError ...
Exception in thread "main" java.lang.NoClassDefFoundError: com/blogspot/debukkitsblog/net/Server
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1010)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:855)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:753)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:676)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:634)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
at fst.serverclient.ssc.SSCNetzwerkTester.main(SSCNetzwerkTester.java:6)
Caused by: java.lang.ClassNotFoundException: com.blogspot.debukkitsblog.net.Server
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
... 10 more
I do not have any idea what am I doing wrong, the jar should work otherwise it should not be there for download I guess. But the error comes from one of the jar classes called Server:
java.lang.NoClassDefFoundError: com/blogspot/debukkitsblog/net/Server
This question already has answers here:
What is a classpath and how do I set it?
(10 answers)
Closed 2 years ago.
When run application from command line I get the following:
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONException
at com.poker5o.Main.main(Main.java:39)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
The application compiled fine and even when i specify class path to the json jar still get same error.
root#poker5o:/usr/local/poker5o/SignalChannel# ls
com json-20190722.jar
root#poker5o:/usr/local/poker5o/SignalChannel# java -cp . com.poker5o.Main
Allocating server socket for the server
Sending parameters to DoListen
Back from DoListen
Setting up read/write buffers
Back from SetBuffers
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONException
at com.poker5o.Main.main(Main.java:39)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 1 more
I managed to solve the problem by extracting the json JAR , so now i have:
com & org directories on my working directory. DO i always need to extract jars ?
and do i allways have to place my appliction in same path that represents full name ? com.poker5o.Main...? what if i want to bundle everything like distribute application is there a good way to do so ?
I've created a java project in Netbeans and I am trying to run it in the command prompt by creating a .jar of the project and then doing java -jar nameOfThePorject.jar but I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/coti/tools/Rutas
at controller.Controller.compruebaBinario(Controller.java:41)
at view.Vista.comienzaLaFiesta(Vista.java:23)
at musicfy.Main.main(Main.java:25)
Caused by: java.lang.ClassNotFoundException: com.coti.tools.Rutas
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:604)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 3 more
How can I fix it?
PS: I am running the project in Netbeans without any error
I use Intelij Idea. On project i use http://www.simplejavamail.org . After build and test run on server i got error:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/slf4j/LoggerFactory
at org.simplejavamail.util.ConfigLoader.<clinit>(ConfigLoader.java:55)
at org.simplejavamail.email.EmailBuilder.<init>(EmailBuilder.java:153)
at com.company.Main.main(Main.java:186) Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
After googleing i add slf4j-simple-1.7.25.jar to libraries, but after build it cause that same error. It's strange because if i trying import it in any project file IDE suggest it. I also try add slf4j-api-1.7.25.jar, slf4j-jdk14-1.7.25.jar but it's stil doesnt't help.
Sorry if i don't write important informations. It's my first java project.