I am trying to build a facebook connector using facebook4j jar.
Whatever I have coded is working fine if I run the classes from eclipse directly, but if when I am trying to create a jar file of my connector which has facebook4j jar as well, and use it in some other Project, I am getting below error:
Exception in thread "main" java.lang.NoClassDefFoundError: facebook4j/FacebookException
at FacebookMain.main(FacebookMain.java:18)
Caused by: java.lang.ClassNotFoundException: facebook4j.FacebookException
I am creating jar file from eclipse only and have checked below option
Export generated class file and resource
Any guidance will be helpful.
Related
When The Program is Ran in the Local PC, it is working fine, but if it is running in the docker throws the following error:
Exception in thread "Thread-16" java.lang.NoClassDefFoundError: org/apache/kafka/common/serialization/Serializer
at org.eclipse.kura.example.configurable.ConfigurableExample$1.run(ConfigurableExample.java:52)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: org.apache.kafka.common.serialization.Serializer cannot be found by org.eclipse.kura.example.configurable_1.0.0.202201251713
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 2 more
But this is working fine in the LocalMachine.
What is the issue ?
This may be debugged in following ways:
Ensure that you have all the required dependencies inside your docker container. You may want to check your docker base image first.
Check if you have set the classpath appropriately to include that jar file (kafka-clients).
Validate your entrypoint/cmd which you use to start the service to check if it has the appropriate classpath.
Check your classloader and see why it is not able to load that class.
If your executable is a fat jar file, check if that jar file contains the kafka-clients library where that class is present.
I am trying to build my quarkus project but it is giving me below expectation, as I am new to it I am not getting exactly what is the problem. Please help me out, I have tried many thing like excluding but nothing works.
2021-02-22 17:36:59,100 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#registerBeans threw an exception: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at java.base/sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:336)
at java.base/sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:269)
at java.base/java.util.jar.JarVerifier.processEntry(JarVerifier.java:273)
at java.base/java.util.jar.JarVerifier.update(JarVerifier.java:230)
at java.base/java.util.jar.JarFile.initializeVerifier(JarFile.java:759)
at java.base/java.util.jar.JarFile.getInputStream(JarFile.java:840)
at io.quarkus.bootstrap.classloading.JarClassPathElement$1$1$1.apply(JarClassPathElement.java:123)
at io.quarkus.bootstrap.classloading.JarClassPathElement$1$1$1.apply(JarClassPathElement.java:118)
at io.quarkus.bootstrap.classloading.JarClassPathElement.withJarFile(JarClassPathElement.java:161)
at io.quarkus.bootstrap.classloading.JarClassPathElement.access$100(JarClassPathElement.java:35)
at io.quarkus.bootstrap.classloading.JarClassPathElement$1$1.getData(JarClassPathElement.java:118)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.getResourceAsStream(QuarkusClassLoader.java:332)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.getResourceAsStream(QuarkusClassLoader.java:353)
at io.quarkus.arc.processor.BeanArchives.index(BeanArchives.java:259)
That sounds like you have a signed jar in your dependencies. When this jar is packed in your jar, java cannot verify it. You have to exclude this jar and use it via classpath.
Maybe you also find some useful information in this post: Invalid signature file digest for Manifest main attributes exception while trying to run jar file
I am trying to send an email from a Java Application but whenever I run the code found online here
When I run the code I receive this error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingException
at nameInProgress.Driver.main(Driver.java:69)
Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
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'm pretty sure that the problem is relating to how I have attached the source (I am not using maven), I have viewed some other solutions on here, the highest suggests attaching a source code zip, but the link to that file is no longer valid and I cannot find it on my own.
EDIT: I have created a build path to JavaMail but I am still receiving this error.
As you stated, you don't have the javax mail jar/dependency. If you aren't using a dependency manager then you'll need to get the jar and add it to your classpath. I found a link for the jar here.
I'm currently updating a legacy code, and below is the error occured.
SEVERE: Servlet.service() for servlet [RequestController] in context with path [/ngsf] threw exception [Servlet execution threw an exception] with root cause java.lang.ClassNotFoundException: com.hierynomus.mssmb2.SMBApiException
Now, MyProject.jar is the one im upgrading to use SMBJ due to limitation to SMB1 from jcifs. Built the jar via eclipse [ right-click project -> export -> JAR File]. After i exported the jar, i delete the old MyProject.jar in WebProject and pasted the new MyProject.jar (basically i've ovewritten the old for the new jar) and ran tomcat via eclipse run server. However, the exception occurred. com.hierynomus.mssmb2.SMBApiException can be found inside smbj-0.9.1.jar.
I did a comparison, using the old jar (using jcifs). everything was good. but when i used the new jar, above exception occured. Basically, i just updated the MyProject.jar. there is no modification on WebProject.
Anyone knows how to fix this?
I have an enterprise app created in Netbeans 6.8 which comes packaged with a Glassfish V3 server. I've been receiving the following exception from the server log when I try to deploy and run the EAR project:
SEVERE: jdbc.exc_cnfe_ds
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
From googling, the common solution to this is to copy the jar file (mysql-connector-java-5.1.6-bin.jar) containing that class to
$glassfish-v3-install-root/glassfish/domains/domain1/lib.
and in fact that's where it resides on the Unix server. However, I'm testing this on windows and the "domains/domain1" directories don't exist in the default glassfish install. I added them manually and added the jar, but it made no difference. I also added the jar as a variable to the windows classpath, but that also had no effect.
I then tried adding the jar file $glassfish-v3-install-root/glassfish/lib, and that produced a different error:
SEVERE: RAR5111 : Error casting to javax.sql.Datasource
java.lang.ClassCastException: com.mysql.jdbc.Driver cannot be cast to javax.sql.DataSource
I'm using the same jar file as exists for the server. I'm guessing the jar is misplaced? I don't want to put it in the project because that's not how it's deployed in production. Any help appreciated.
Putting the jar file in $glassfish-v3-install-root/glassfish/lib turned out to be correct.
The
"SEVERE: RAR5111 : Error casting to javax.sql.Datasource java.lang.ClassCastException: com.mysql.jdbc.Driver cannot be cast to javax.sql.DataSource"
error was, I believe, caused by an incorrect setting for the jdbc pooling on the glassfish server. But going to the admin console, available from the Netbeans "server" tab, going to the "JDBC", "Connection Pools", select "java.sql.driver" as the resource type and "com.mysql.jdbc.driver" as the driver classname will get rid of the casting issue.
Click the "Ping" button near the top to make sure you're connecting.