Quartz scheduler job - java

I have tried to make a scheduler job using quartz library. I have added the quartz-all-xxx.jar file but it's showing me error
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.quartz.impl.StdSchedulerFactory.<init>(StdSchedulerFactory.java:298)
at org.quartz.impl.StdSchedulerFactory.getDefaultScheduler(StdSchedulerFactory.java:1516)
at Main.Schedular.main(Schedular.java:19)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 3 more
so is there any other jar file I have to add ???

As you can see on this Maven repository page the quartz library has a dependency to org.slf4j.
Given your version of quartz, add the proper dependency version to your classpath.

You need to add SLF4J-API. Or, you know, use maven or something…
Edit: and probably some implementation.

Related

Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable

I am trying to create a simple spring boot application from the STS starter project template.
So I create using the STS wizard as below:
File->New->Spring Starter Project
* Type: Maven
* Packaging: jar
* Language: java *ver:1.8*
* Spring Boot version: 1.5.8
* Selected dependencies:
-> Actuator
-> JPA
-> H2
-> Web
And this is my project structure after it finishes:
Now I don't change anything in the project, I simply try to run the main class as a Java Application but I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at io.yassir.springboot.SbCdCollectionApplication.main(SbCdCollectionApplication.java:10)
Caused by: java.lang.ClassNotFoundException: org.springframework.core.env.EnvironmentCapable
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 13 more
I have found other questions with the same issue, but none of the answers worked for me because I didn't even configure the project, it's spring's pre-configuration.
I resolved the problem by deleting maven local repository at ~\.m2\repository and then re-setting eclipse configuration to default.
This issue is caused by local jars being corrupted, or invalid eclipse build settings.

Executing jar file throws class not found error

Using Eclipse, I am modifying a Java project we have been using for years. a specific class method is typically executed by sending a message through IBM WebSphere MQ. However, I now have a need to develop some new functionality and I need to be able to test it out side the MQ world.
I am able to successfully debug the application in Eclipse, but if I attempt to execute the jar file from a command prompt I receive the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: XMLBuilder/Node
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: XMLBuilder.Node
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 6 more
My build is done using an ant script. This does not include a Class-Path attribute when creating the manifest.
The XMLBuilder.jar file is included in the target jar. Running jar -tf file.jar shows
META-INF/)
META-INF/MANIFEST.MF)
... Omitted for Brevity ...
XMLBuilder.jar
What might I be missing?
Thank you

java.lang.ClassNotFoundException: org.bouncycastle.asn1.ASN1Encodable

I am using IText 4.2.0 and bcprov-jdk15-1.43.jar and bctsp-jdk15-1.43.jar for signing pdf. I added these jars by add external jars button in Eclipse. When I execute it gives me following error.
ExceptionConverter: java.lang.Exception: Failed to get TSA response from tsaURL
at com.lowagie.text.pdf.TSAClientBouncyCastle.getTimeStampToken(TSAClientBouncyCastle.java:185)
at com.lowagie.text.pdf.TSAClientBouncyCastle.getTimeStampToken(TSAClientBouncyCastle.java:136)
at com.lowagie.text.pdf.PdfPKCS7.getEncodedPKCS7(PdfPKCS7.java:1236)
at pack1.PDFSigningWithHSM.PDFSigningWithHSM.main(PDFSigningWithHSM.java:489)
Caused by: java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1Encodable
at com.lowagie.text.pdf.TSAClientBouncyCastle.getTimeStampToken(TSAClientBouncyCastle.java:146)
... 3 more
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.asn1.ASN1Encodable
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more
But I see Class ASN1Encodable in the jar file bcprov-jdk15-1.43.jar. I dont understand what is the problem.
That exception means that the classloader cannot find that class at runtime. We don't have enough information to determine why it is the case ... but it is definitely the cause of your problems.
Check that the offending JAR file is actually on your application's effective runtime classpath.

Java programs cannot run after downloading opencsv

I downloaded the opencsv (from http://sourceforge.net/projects/javacsv/files/latest/download) and since then I have been getting this error with all my Java programs
java.lang.NoClassDefFoundError: HelloWorld
Caused by: java.lang.ClassNotFoundException: HelloWorld
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Exception in thread "main"
How can I fix this? I realized I didn't need the opencsv anyway...how can I remove it so that my programs can compile and run as usual? I'm using Eclipse Version: 1.4.2.20120213-0813
You can remove a plugin by going to Help->About (or Eclipse->About on a Mac), choosing installations details, selecting the plugin you wish to remove, and choosing 'Uninstall'.

LibreOffice SDK bootstrap

I got the standard jar files + juh-2.4.1.jar and ridl-3.2.1.jar (got errors on import) as referenced libraries in my project. When i get an example piece of code from http://api.libreoffice.org/examples/DevelopersGuide/examples.html#FirstSteps i always land on this error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/star/comp/loader/JavaLoader
at com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(Bootstrap.java:118)
at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:241)
at TextDocuments.getRemoteServiceManager(TextDocuments.java:410)
at TextDocuments.storePrintExample(TextDocuments.java:378)
at TextDocuments.runDemo(TextDocuments.java:152)
at TextDocuments.main(TextDocuments.java:142)
Caused by: java.lang.ClassNotFoundException: com.sun.star.comp.loader.JavaLoader
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 6 more
Always a NoClassDefFoundError on bootstrap.. Searching for this but can't find much.. Anybody has an idea how to fix this?
In my LibreOffice installation the missing class is located in the file jurt.jar

Categories