We have a jar file, which was compiled with java 1.6, and it was working fine.
Last month system were upgraded with java 8.
and now the java code gives the following error -
F:\globaltl\ConcurDump>java -jar ConcurDumpProcessLatest.jar prod
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/c
ontext/ApplicationContext
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:56)
Caused by: java.lang.ClassNotFoundException: org.springframework.context.Applica
tionContext
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)
Is this issue because of the version upgrade?
The same jar used to work fine with older java version.
Related
I am facing NoClassdeffoundError due to class not found exception for Java batch application.jar files are deployed on the windows server these batch jars are getting executed via bat file from Tivoli job schedular .But I am totally clueless why it is occurring only some times in a day or in week.This issue is not coming on QA Environment but on production it occurring.My logs are as follows
java.io.IOException: An unexpected network error occurred
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(Unknown Source)
at org.apache.logging.log4j.core.appender.OutputStreamManager.writeToDestination(OutputStreamManager.java:256)
... 29 more
java.lang.NoClassDefFoundError: org/apache/commons/lang3/exception/ExceptionUtils
at com.xxx.yy.batch.BatchExecutor.processFiles(BatchExecutor.java:322)
at com.xxx.yy.batch.BatchExecutor.processZipFiles(BatchExecutor.java:235)
at com.xxx.yy.batch.BatchExecutor.readFilesAndUpdateTables(BatchExecutor.java:204)
at com.xxx.yy.batch.BatchExecutor.executeBatch(BatchExecutor.java:85)
at com.xxx.yy.batch.BatchExecutor.main(BatchExecutor.java:65)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.exception.ExceptionUtils
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)
... 5 more
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/io/Java7Support
at org.apache.commons.io.FileUtils.isSymlink(FileUtils.java:3089)
at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1574)
at com.xxx.yy.batch.processor.BatchProcessor.cleanFiles(BatchProcessor.java:426)
at com.xxx.yy.batch.BatchExecutor.executeBatch(BatchExecutor.java:147)
at com.xxx.yy.batch.BatchExecutor.main(BatchExecutor.java:65)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.Java7Support
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)
... 5 more
I confirmed that my class path is correct all the jars and classes are present.
I get this exception after exporting into a .jar file with eclipse. IntelliJ says the same. But my program is working fine in eclipse.
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
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 sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
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)
... 13 more
What could be the matter of this?
JDK version: 1.7.0_79
Starting: java -jar myapp.jar
After trying it with java -cp jfxrt.jar -jar myapp.jar it gives me the following error:
java -cp jfxrt.jar -jar memo.jar
Exception in thread "JavaFX Application Thread" Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Layout
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplicationWithArgs$100(LauncherImpl.java:352)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$119(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$117(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$118(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.lambda$null$450(GtkApplication.java:139)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Layout
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 11 more
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.NullPointerException
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:383)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
... 5 more
The javafx.application.Application class is going to be found in a javafx library; in an IDE such as eclipse you generally configure a project to refer to those libraries it needs for compilation and execution. When you put your code into a jar and run it outside the IDE, you need to provide the library to the runtime a different way.
A standard way to do this is to set a classpath which has references to both the application jar and to any libraries it needs; the DOS command to do this would look something like:
set classpath=c:\myProjects\myApplication\myJar.jar;c:\java\libaries\javafx\jfxrt.jar
and then java would have access to the classes in both those jar files
Oracle JDK includes JavaFX on the classpath from version 1.8 onwards; if you upgrade your JDK to version 8 or later it should run. I do not recommend building production-level JavaFX applications with versions prior to Java 8 anyway.
If you really do want to use Java 7, consider using the built-in JavaFX deployment tools to build the jar, instead of the vanilla "create executable jar" from eclipse. These will properly build a jar file that includes the FX runtime, if needed. The easiest way to do this in Eclipse is to install e(fx)clipse (an Eclipse plugin); there's a tutorial which includes steps to build the jar file.
I get this exception after exporting into a .jar file with eclipse. IntelliJ says the same. But my program is working fine in eclipse.
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
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 sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
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)
... 13 more
What could be the matter of this?
JDK version: 1.7.0_79
Starting: java -jar myapp.jar
After trying it with java -cp jfxrt.jar -jar myapp.jar it gives me the following error:
java -cp jfxrt.jar -jar memo.jar
Exception in thread "JavaFX Application Thread" Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Layout
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplicationWithArgs$100(LauncherImpl.java:352)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$119(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$117(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$118(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.lambda$null$450(GtkApplication.java:139)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Layout
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 11 more
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.NullPointerException
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:383)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
... 5 more
The javafx.application.Application class is going to be found in a javafx library; in an IDE such as eclipse you generally configure a project to refer to those libraries it needs for compilation and execution. When you put your code into a jar and run it outside the IDE, you need to provide the library to the runtime a different way.
A standard way to do this is to set a classpath which has references to both the application jar and to any libraries it needs; the DOS command to do this would look something like:
set classpath=c:\myProjects\myApplication\myJar.jar;c:\java\libaries\javafx\jfxrt.jar
and then java would have access to the classes in both those jar files
Oracle JDK includes JavaFX on the classpath from version 1.8 onwards; if you upgrade your JDK to version 8 or later it should run. I do not recommend building production-level JavaFX applications with versions prior to Java 8 anyway.
If you really do want to use Java 7, consider using the built-in JavaFX deployment tools to build the jar, instead of the vanilla "create executable jar" from eclipse. These will properly build a jar file that includes the FX runtime, if needed. The easiest way to do this in Eclipse is to install e(fx)clipse (an Eclipse plugin); there's a tutorial which includes steps to build the jar file.
I am trying to run a groovy project in windows java rembrandt.bin.Rembrandt and i got the following error
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/groovy/r
untime/BytecodeInterface8
at rembrandt.bin.Rembrandt.<init>(Rembrandt.groovy)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstru
ctor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteN
oUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstru
ctor(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor
(AbstractCallSite.java:190)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor
(AbstractCallSite.java:198)
at rembrandt.bin.Rembrandt.main(Rembrandt.groovy:383)
Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.Bytecod
eInterface8
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)
... 11 more
I am using java 8. the funny thing is that i tried to run in Linux and the program worked.In Linux i am running java 7, but already tried with java 7 in windows and nothing. I am using groovy 1.7.5 and this class( BytecodeInterface8) only appear in 1.8.0 i cant understand why this run fine in Linux and not in windows. Ty for your help
Trying to run a program in Eclipse on Tomcat 7.0.12 and I'm getting this error:
java.lang.NoClassDefFoundError: and
Caused by: java.lang.ClassNotFoundException: and
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)
Exception in thread "main"
I have no clue what could be causing this.
You must install the troublesome program to a folder without spaces in the full name.