Sunday, June 19, 2011

I know how frustrating is to see Exception in thread "main" java.lang.NoClassDefFoundError, which is a manifestation of NoClassDefFoundError in Java. I have seen it couple of times and spent quite a lot time initially to figure out what is wrong , which class is missing etc. First mistake I did was mingling java.lang.ClassNotfoundException and NoClassDefFoundError, in reality they are totally different, and my second mistake was using trial and error method to solve this java.lang.NoClassDefFoundErrorinstead of understanding why NoClassDefFoundError is coming, what is real reason behind NoClassDefFoundError and how to resolve this. In this Java tutorial I have tried to rectify that mistakes and uncover some secrets of NoClassDefFoundError in Java and will share my experience around it. NoClassDefFoundError is not something which cannot be resolved or hard to resolve it’s just its manifestation which puzzles most of Java developer. This is the most common error in Java development along with java.lang.OutOfMemoroyError: Java heap space and java.lang.OutOfMemoryError: PermGen spaceAnyway let’s see Why NoClassDefFoundError comes in Java and what to do to resolve NoClassDefFoundError in Java.

What is reason of NoClassDefFoundError in Java?

NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available during compile time. For example if we have a method call from a class or accessing any static member of a Class and that class is not available during run-time then JVM will throw NoClassDefFoundError. It’s important to understand that this is different than ClassNotFoundExceptionwhich comes while trying to load a class at run-time only and name was provided during runtime not on compile time. Many Java developer mingle this two Error and gets confused.

In short NoClassDefFoundError will come if a class was present during compile time but not available in java classpath during runtime. Normally you will see below line in log when you get NoClassDefFoundError:

Exception in thread "main" java.lang.NoClassDefFoundError

Exception in thread “main” simply indicate that its “main” thread which is not able to find a particular class it could be any thread so just don’t worry . Difference between this error coming in main thread and other thread is , when Exception in thread “main” comes program crashes or shut it self down as opposed to other thread in which case your program will continue to run.,

Difference between java.lang.NoClassDefFoundError and ClassNotFoundException in Java

Many a times we confused ourselves with java.lang.ClassNotFoundException and java.lang.NoClassDefFoundError, though both of them related to Java Classpath they are completely different to each other. ClassNotFoundException comes when JVM tries to load a class at runtime dynamically means you give the name of class at runtime and then JVM tries to load it and if that class is not found in classpath it throws java.lang.ClassNotFoundException. While in case of NoClassDefFoundErrorthe problematic class was present during Compile time and that's why program was successfully compile but not available during runtime by any reason. NoClassDefFoundError is easier to solve than ClassNotFoundExceptionin my opinion because here we know that Class was present during build time but it totally depends upon environment, if you are working in J2EE environment than you can get NoClassDefFoundError even if class is present because it may not be visible to corresponding class loader. See my post NoClassDefFoundError vs ClassNotFoundException in Java for more details.

How to resolve java.lang.NoClassDefFoundError in Java

Obvious reason of NoClassDefFoundErroris that a particular class is not available in Classpath, so we need to add that into Classpath or we need to check why it’s not available in Classpath if we are expecting it to be. There could be multiple reasons like:

5) If you are working in J2EE environment than visibility of Class among multiple Classloadercan also cause java.lang.NoClassDefFoundError, see examples and scenario section for detailed discussion.

We will now see couple of example and scenarios when java.lang.NoClassDefFoundErrorhas came before and how its been resolved. This can help you to troubleshoot root cause of NoClassDefFoundError in Java application.

NoClassDefFoundError in Java - Example and Scenarios

1. Simple example of NoClassDefFoundErroris class belongs to a missing JAR file or JAR was not added into classpath or sometime jar's name has been changed by someone like in my case one of my colleague has changed tibco.jar into tibco_v3.jar and by program is failing with java.lang.NoClassDefFoundErrorand I was wondering what's wrong.

2. Class is not in Classpath, there is no sure shot way of knowing it but many a times you can just have a look to print System.getproperty("java.classpath")and it will print the classpath from there you can at least get an idea of your actual runtime classpath.

3. Just try to run with explicitly -classpath option with the classpath you think will work and if its working then it's sure short sign that some one is overriding java classpath.

NoClassDefFoundError in Java due to Exception in Static Initializer block

This is another common reason of java.lang.NoClassDefFoundError, when your class perform some static initialization in static block like many Singleton classes initialized itself on static block to take advantage of thread-safety provided by JVM during class initialization process, and if static block throw an Exception, the class which is referring to this class will get NoclassDefFoundError in Java. If you look at your log file you should watch for any java.lang.ExceptionInInitializerErrorbecause that could trigger java.lang.NoClassDefFoundError: Could not initialize class on other places. Like in below code example, During class loading and initialization User class is throwing Exception from static initializer block, which trigger ExceptionInInitializerErrorduring first time loading of User class in response to new User() call. Later rest of new User() are failing as java.lang.NoClassDefFoundError. situation gets worst if original ExceptionInInitializerError, which is root cause here is silently eaten by any code.

Outputjava.lang.ExceptionInInitializerError
at testing.NoClassDefFoundErrorDueToStaticInitFailure.main(NoClassDefFoundErrorDueToStaticInitFailure.java:23)
Caused by: java.lang.RuntimeException: UserId Not found
at testing.User.getUserId(NoClassDefFoundErrorDueToStaticInitFailure.java:41)
at testing.User.<clinit>(NoClassDefFoundErrorDueToStaticInitFailure.java:35)
... 1 morejava.lang.NoClassDefFoundError: Could not initialize class testing.User
at testing.NoClassDefFoundErrorDueToStaticInitFailure.main(NoClassDefFoundErrorDueToStaticInitFailure.java:23)

5) Since NoClassDefFoundError is a also a LinkageError which arises due to dependency on some other class , you can also get java.lang.NoClassDefFoundError if your program is dependent on native library and corresponding dll is not there. Remember this can also trigger java.lang.UnsatisfiedLinkError: no dll in java.library.path Exception Java. In order to solve this keep your dll along with JAR.

6) If you are using ANT build file create JAR and manifest file than its worth noting to debug till that level to ensure that ANT build script is getting correct value of classpath and appending it to manifest.mf file.

7) Permission issue on JAR file can also cause NoClassDefFoundError in Java. If you are running your Java program in multi-user operating system like Linux than you should be using application user id for all your application resources like JAR files, libraries and configuration. If you are using shared library which is shared among multiple application which runs under different users then you may run with permission issue , like JAR file is owned by some other user and not accessible to your application. One of our reader “it’s me said” faced java.lang.NoClassDefFoundError due to this reason. See his comment also.

8) Typo on XML Configuration can also cause NoClassDefFoundError in Java. As most of Java frameworks like Spring, Struts they all use xml configuration for specifying beans. By any chance if you put the bean name wrong, it may surface as java.lang.NoClassDefFoundError while loading other class which has dependency on wrongly named bean. This is quite common on Spring MVC framework and Apache Struts where you get tons of Exception in thread "main" java.lang.NoClassDefFoundError, while deploying your WAR or EAR file.

9) Another example of java.lang.NoClassDefFoundError as mentioned by our reader Nick is that when your compiled class which is defined in a package, doesn’t present in same package while loading like in case of JApplet it will throw NoClassDefFoundError in Java. Also see Nick’s comment on this error.

10) java.lang.NoClassDefFoundErrorcan be causeddue to multiple classloaders in J2EE environments. Since J2EE doesn’t mention standard class-loader structure and it depends upon different vendors like Tomcat, WebLogic, WebSphere on how they load different components of J2EE like WAR file or EJB-JAR file. In order to troubleshoot NoClassDefFoundError in J2EE application knowledge of How ClassLoader works in Java is mandatory. Just to recap ClasLoader works on three principle delegation, visibility and uniqueness. Delegation means every request to load a class is delegated to parent classloader, visibility means ability to found classes loaded by classloader, all child classloader can see classes loaded by parent classloader but parent classloader can not see the class loaded by child classloaders. Uniqueness enforce that class loaded by parent will never be reloaded by child clasloaders. Now suppose if a class say User is present in both WAR file and EJB-JAR file and loaded by WAR classloader which is child classloader which loads class from EJB-JAR. When a code in EJB-JAR refer to this User class, Classloader which loaded all EJB class doesn’t found that because it was loaded by WAR classloader which is child of it. This will result in java.lang.NoClassDefFoundError for User class. Also If class is present in both JAR file and you will call equals method to compare those two object, it will result in ClassCastException as object loaded by two different classloader can not be equal.

11) Some of reader of this blog also suggested that they get Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/Main , this error means either your Classpath, PATH or JAVA_HOME is not setup properly or JDK installation is not correct. which can be resolved by re-installing JDK. IF you are getting this error try to reinstall JDK . One of our reader got this issue after installing jdk1.6.0_33 and then reinstalling JDK1.6.0_25, he also has his JRE and JDK on different folder. See his comment also by searching JDK1.6.0_33 .

12) Java program can also throw java.lang.NoClassDefFoundErrorduring linking which occurs during class loading in Java. One of the example of this scenario is just delete the User class from our static initializer failure example after compilation and they try to run the program. This time you will get java.lang.NoClassDefFoundErrordirectly without java.lang.ExceptionInInitializerErrorand message for NoClassDefFoundError is also just printing name of class as testing/User i.e. User class from testing package. Watch out for this carefully as here root cause is absent of User.class file.

Let me know how exactly you are facing NoClassDefFoundError in Java and I will guide you how to troubleshoot it, if you are facing with something new way than I listed above we will probably document if for benefit of others and again don’t afraid with Exception in thread "main" java.lang.NoClassDefFoundError.

177 comments
:

Anonymous
said...

I am getting java.lang.NoClassDefFoundError while running my program in Eclipse IDE. I checked the classpath and seems class is there. Eclipse is giving so much problem to me can any one help else has got NoClassDefFoundError in Eclipse ?

NoClassDefFoundError mainly occurs at that time, when you have the class present in the JVM, however the JVM could not be able to load the class because of some reason (that can be either can exception is being thrown in the static block of the class) or for some other reason. However ClassNotFoundException seems to occur, while loading the main program, it does not found a class, which is being expected to be present.

Hi Anusha, Can you post some error here, is related to JUnit ? ClassNotFoundException comes when JVM tries to load class as result of method call Class.forName(), ClassLoader.findSystemClass() or ClassLoader.loadClass()

yeah, i am getting this exception when trying to run JUNIT.below is the exception.

java.lang.ClassNotFoundException: 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 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:425) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Hi Anusha, do you have JUnit library added in your buildpath, you can check it by right click on your project --> properties-->Java build Path-->library, if not then you can add there as Add library -->Junit. if yes then it may possible that some of the jar in your build path is not present ( int his case your project must have some erorr) due to which Eclipse not able to find JUnit classes.

iam also getting same error when trying to start the Tomcat service.Below is infoCaused by: java.lang.NoClassDefFoundError: org/apache/naming/resources/ProxyDirContext at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328) at java.lang.Class.getConstructor0(Class.java:2640) at java.lang.Class.newInstance0(Class.java:321) at java.lang.Class.newInstance(Class.java:303) at org.apache.commons.digester.ObjectCreateRule.begin(ObjectCreateRule.java:253) at org.apache.commons.digester.Rule.begin(Rule.java:200) at org.apache.commons.digester.Digester.startElement(Digester.java:1273) at org.apache.catalina.util.CatalinaDigester.startElement(CatalinaDigester.java:65) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1548) at org.apache.catalina.startup.Catalina.load(Catalina.java:489) at org.apache.catalina.startup.Catalina.load(Catalina.java:528) ... 6 more

/red5# sh red5.shRunning on LinuxStarting Red5Picked up _JAVA_OPTIONS: -Xms64M -Xmx128mException in thread "main" java.lang.NoClassDefFoundError: &LOGGING_OPTSCaused by: java.lang.ClassNotFoundException: &LOGGING_OPTS at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248)Could not find the main class: &LOGGING_OPTS. Program will exit.

Please check you have similar versions of JRE. Many times it happened with me that my classes were compiled with JRE 1.5.2 and I was deploying them on a server which was using JRE 1.5.0. Make sure you compile using the server's JRE and then try again.

Hi, I am trying to use display tag library in my jsp page for showing some data in tabular format but while running that jsp page I am getting NoClassDefFoundError.

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/UnhandledException at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) at java.lang.Class.getConstructor0(Class.java:2699) at java.lang.Class.newInstance0(Class.java:326) at java.lang.Class.newInstance(Class.java:308)

Hi Anonymoust.Displaytag has dependency on some third party jars like apache commons lang, poi , tyring adding all those library and you will be fine. a quick ways is to download display tag example war file comes along with display tag download in source forge site and then use all jars from the /WEB-INF/lib in your project and you will be free of Exception in thread "main" java.lang.NoClassDefFoundError:

i am using google map library in my android application where i am extending MapActivity in my application.Now i am getting NoClassDefFound while opening this activity. I am developing this project in Eclipse 3.6 under google api 2.2and running on emulator with google api 2.2. i even set maps library of android sdk in my build path of project. Please help me.

I have written a filter to authorize my application which takes ldap details from context.xml. I have used spring to create objects to the bean in the context.xml and to work with it. context.xml contains only one bean, named "directory".

I am getting the below error while running the application. Can any one help me..

First, thanks for the post. I have the same problem. I use eclipse, and when i do system.getproperty("java.classpath"), the code prints "null", in every project that i have...

All the JAR are added in the project, and i get:Exception in thread "main" java.lang.NoClassDefFoundError: mss/comm/winBT/WinBT at mss.communication.Communication.(Communication.java:16) at mss.comm.win.Main.(Main.java:39) at mss.comm.win.Main.main(Main.java:99)Caused by: java.lang.ClassNotFoundException: mss.comm.winBT.WinBT

The problem Exception cames when i try to initialize the class "mss/comm/winBT/WinBT" from "mss.communication.Communication". Can you help me?

The situation is my uni is marking our java assignment using a system called Plate.

\\\\\\\\The root class must be named Trader and must include a static main method for yourcode to be marked by PLATE. You must have the first two lines of code for PLATE to run. Thecode inside the method should contain only a call to the constructor, as shownpublic class Trader{ public static void main(String[] args){ new Trader (); }\\\\\\\\\

I use BlueJ as the IDE. My code runs if I run the main method, but is not running after I exported to jar file. When exporting, I chose, include source, Main clas: Trader. Here is my jar, if you can take a look at it, that will be great.

>2) You might be running your program using jar >command and class was not defined in manifest file's >ClassPath attribute.Pointed me to my mistake, which i just spent 2h or so.Run a *.jar without java -jar option and you get the same error, with all classes being where they should be.

I could add some light. For those who use Eclipse if you right clicked on the server > "Publish" then you'll get this error. I solved right clicking on the server > "Clean". My code was ok. I just don't know what are those Eclipse options.

Hi everybody, I have this problem ONLY with Eclipse: if I try to compile by terminal this is all right. The whole error that Eclipse manifet is:

Exception in thread "main" java.lang.NoClassDefFoundError: Caused by: java.lang.ClassNotFoundException: at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Hi tita, you probably need to paste root cause for which clas is throwing java.lang.ClassNotFoundException ? or may be context what you are doing. I m sure there would be some thing which tells during for which particular class its showing this error.

Just thought I'd share that it's also worth checking permissions on the class libraries your application is loading. Incorrect user permissions (for instance root owning a library that should be owned by appuser) could lead to a java.lang.NoClassDefFoundError.

Recently I went through this. My application was failing with :

java.lang.NoClassDefFoundError: com/class/failedclass

The application runs as appuser and imports failedlcass from the class-loader.jar library located: /usr/local/myapp/lib/class-loader.jar

After making sure the library existed in the correct place I started the application with strace attached which led me to the problem :

I am facing the NoClassDefFoundError in my Android app together with the ClassNotFoundError. The app's architecture is that I have a free and a pro version that both are using the same library project.The .classpath file has the entry (among other things):"kind='con' path='com.android.ide.eclipse.adt.LIBRARIES'"and the Android manifest mentiones the activity explicitly. Am i supposed to add the library project's jar explicitly to the classpath? What am I missing here?

hii..I have a problem with NoClassDefFoundError this is the error:SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateSearchSupport' defined in class path resource [applicationContext-hibernate.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: com/trg/search/ISearch at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)can You help me to analyst this error :Dthanks before

Hi, I am facing a problem with NoClassDefFoundError as below. please help me out.------------------------------------------------java.rmi.ServerError: Error occurred in server thread; nested exception is: java.lang.NoClassDefFoundError: Could not initialize class com.hp.apps.nuncas.server.facade.RMINUNCASFacade_Stub at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:333) at sun.rmi.transport.Transport$1.run(Transport.java:159) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:155) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142) at com.compaq.libs.temip.applicationinterface.RemoteSession_Stub.getFacade(Unknown Source) at com.hp.apps.nuncas.client.base.SessionClient.e(SourceFile:154) at com.hp.apps.nuncas.client.base.SessionClient.a(SourceFile:54) at com.hp.apps.nuncas.client.base.SessionClient.b(SourceFile:74) at com.hp.apps.nuncas.client.base.SessionClient.main(SourceFile:179)Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.hp.apps.nuncas.server.facade.RMINUNCASFacade_Stub -----------------------------------------------Note : But RMINUNCASFacade_Stub.class exists under com.hp.apps.nuncas.server.facade.

hi, i created some java files when i run them using netbeans or eclipse they works well. but when i try to run using command prompt i am getting some errors. i am using mysql connector jar files. i have placed all my java files and mysql connector jar in jdk/bin folder. and i hve set my claaspath to jdk/bin folder. i get errors like

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at Dbconnection.Dbconnect(Dbconnection.java:29) at fileoperation.parsefiles(fileoperation.java:63) at fileoperation.main(fileoperation.java:127)

if possible will you please mail me your suggestion . i am a student developing a web application . i ahve my project demo day after tmrw i got stuck there. will anybody help me???my mail id is adeshbora@gmail.com

sir we created one batch file parse.bat. we put all source files in C:\Program Files\Java\jdk1.6.0\bin folder that is all java files. and we also put mysql connector in that folder. but when we run that batch file we get errors like

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at Dbconnection.Dbconnect(Dbconnection.java:29) at fileoperation.parsefiles(fileoperation.java:63) at fileoperation.main(fileoperation.java:127)

i guess it is the error of classpath. we included that mysql connector jar file in jdk/bin folder and we have set class path to classpath=C:\Program Files\Java\jdk1.6.0\bin

we have gone through some pdf and documents that we googled related to setting up classpath. we also posted our problems on stackoverflow . we have bloged our problem on some blogpost also. we searched a lot over the net. but no positive outcome. we got stuck there. we need your help sir.

Hi Adesh, you don't need to put your code bin folder that's not a proper place you can put your source file anywhere and just need to set your path and classpath properly. run your program with -cp . e.g. java -cp . Helloworld.

if i palced all my source files and my sql connector E:\marketpoint\src\java\com\das\dbmodule so what can be my class path . i included all my source file in com.das.dbmodule package . is it okay to run from command prompt to include package statement or should i remove it .. can i get ur mail id so that i can mail u easily

Hi Javin, Thanks for the reply. Actually. we are migrating our application from JDK 1.4 to JDK 1.6 on HP-UX. what we did is, we compiled all java sources of our application through 1.6 compiler and made jar from it and using the same.Actually, I am getting error when try to create instance of my application through other jar file just to establish connection from client to server using, Class name = class.forname(class nmae); Object obj = name.newInstance(); I debugged the same, It is throwing above exception while execuing name.newInstance(); statement.But it is loading the class through class.forname properly. i still confuse y it is not happening for 1.6!!. I am not sure where I am doing wrong.

Hey! I'm so glad I found this blog! I'm struggling with the same issue NoClassDefFoundError with javax.microedition.io.PushRegistry, and I was pissed off when I checked the API and saw that the class was defined... then I checked the my machine to be sure that the PushRegistry.class was included in the JME SDK 3.0 directory bundled with the Netbeans, low and behold it was there! So WTF right? I still don't know how to resolve the issue so I'm hoping someone in this discussion might help me out. If you can just post a comment @RRH Thanks!

hi,i am facing the following problemthe program compiles well in the terminalbut can't load the applet and it showing

java.lang.NoClassDefFoundError: SnakeAndLadderApplet (wrong name: assign1/SnakeAndLadderApplet) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:634) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:197) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:146) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:608) at sun.applet.AppletPanel.createApplet(AppletPanel.java:798) at sun.applet.AppletPanel.runLoader(AppletPanel.java:727) at sun.applet.AppletPanel.run(AppletPanel.java:380) at java.lang.Thread.run(Thread.java:679)please someone help.....

Hi, I'm not a programmer just a regular user of an iMAC. I have application I use to download data from a console that records my exercise work out, e.g. distance, time, KJ, HR, power etc. When I attach my console via a USB cable, the error message I receive is "no supported devices were found". However the detail error message reads as per below.

java.lang.NoClassDefFoundError: Could not initialize class com.cycleops.d2xx.D2xx at com.cycleops.jpowertap.Manager.getConnectedDevices(Manager.java:218) at com.cycleops.devicemanager.DeviceManager.getSelectedDevice(DeviceManager.java:139) at com.cycleops.devicemanager.DeviceManager.getSelectedDevice(DeviceManager.java:80) at com.cycleops.devicemanager.DeviceManager.getSelectedDevice(DeviceManager.java:71) at com.cycleops.devicemanager.DownloadDeviceAction.performAction(DownloadDeviceAction.java:65)

Does anyone know from looking at below, if the issue lies within the app it self or JAVA, as both were download as updates from the respective sites, i.e. JAVA from Apple site and PowerAgent from cyclops site, i.e. I just select the install button and do nothing else, In each case the updates indicate as "successful installation".

@Anonymous, looks like issue with App configuration which requires some settings to be enabled and may not be enable in your Device,though just a guess. I would suggest contacting there support or looking on there installation guide for any pointers (e.g. any settings), shouldn't be issue with Java.

Great post Javin on this common error. I'm glad to see what you spent some time understand this problem at a deeper level. Your Blog has quite a lot of Java tutorials and problem patterns; great sharing for the Java community.

I would like to add that in my Java EE experience, the typical root cause of NoClassDefFoundError that I see from my clients Java EE apps are either classpath / libraries conflict or code failure of a static{} block. For people interested, I also have a post from my Blog on the NoClassDefFoundError problem patterns from a Java EE perspective along with a sample Java program simulation.

Got both exceptions....java.lang.NoClassDefFoundError and java.lang.ClassNotFoundException

not sure what's that I'm missing here...Any help is highly appreciated.

Exception in thread "main" java.lang.NoClassDefFoundError: org.eclipse.core.runtime.CoreException at java.lang.J9VMInternals.verifyImpl(Native Method) at java.lang.J9VMInternals.verify(J9VMInternals.java:69) at java.lang.J9VMInternals.initialize(J9VMInternals.java:131) at com.ibm.ws.webservices.multiprotocol.discovery.ServiceProviderManager.getDiscoveredServiceProviders(ServiceProviderManager.java:378) at com.ibm.ws.webservices.multiprotocol.discovery.ServiceProviderManager.getAllServiceProviders(ServiceProviderManager.java:214) at com.ibm.ws.webservices.multiprotocol.discovery.ServiceProviderManager.getExtensionRegistry(ServiceProviderManager.java:329) at com.ibm.ws.webservices.multiprotocol.discovery.ServiceProviderManager.getWSDLFactory(ServiceProviderManager.java:311) at com.ibm.ws.webservices.multiprotocol.AgnosticServiceFactory.getDefinitionFromURL(AgnosticServiceFactory.java:496) at com.ibm.ws.webservices.multiprotocol.AgnosticServiceFactory.createService(AgnosticServiceFactory.java:164) at sf.application.automation.ws.client.Tempclient.testWebservice1(Tempclient.java:73) at sf.application.automation.ws.client.Tempclient.main(Tempclient.java:228)Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.CoreException at java.net.URLClassLoader.findClass(URLClassLoader.java:497) at java.lang.ClassLoader.loadClass(ClassLoader.java:639) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:605) ... 11 more

I think there is a more fundamental problem. I have just tried to compile the .java file and it claims that it cannot find packages, even though the packages are there in same directory! I have tried also setting the classpath and the sourcepath.

HELPi am making a mod for this game minecraft(www.minecraft.net) and i am working on a plugin mod. when i load the plugins on eclipse it works just fine and if i have no plugins it works fine but when i try to start it outside of eclipse i get this

error:java.lang.NoClassDefFoundError: org/Command at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:791) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at org.PluginManager.LoadPlugins(PluginManager.java:48) at mod_spchat.load(mod_spchat.java:38) at ModLoader.init(ModLoader.java:877) at ModLoader.addAllRenderers(ModLoader.java:186) at aho.(aho.java:79) at aho.(aho.java:9) at net.minecraft.client.Minecraft.a(Minecraft.java:423) at net.minecraft.client.Minecraft.run(Minecraft.java:784) at java.lang.Thread.run(Thread.java:722)Caused by: java.lang.ClassNotFoundException: org.Command at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 20 more

Hi everyone:When you have this kind of problem you have to be sure that all the jars are added in the main project's build path. I had this error and I was freaking out :P I had a jar file that I was using in a project (main project) but this jar file was using another jar file. That last jar file was the problem. It wasn't in the build path of the main project. The problem was solved when I added it in the main project's build path.

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.commons.httpclient.HttpMethodBase.(HttpMethodBase.java:104) at com.hyperion.bpma.utilities.WebUtilities.postAction(WebUtilities.java:64) at com.hyperion.bpma.actions.SessionActions.getSSOToken(SessionActions.java:150) at com.hyperion.bpma.actions.SessionActions.Login(SessionActions.java:53) at com.hyperion.bpma.commands.CommandProcessor.processCommand(CommandProcessor.java:111) at com.hyperion.bpma.cli.BPMAPlus.processCommand(BPMAPlus.java:404) at com.hyperion.bpma.cli.BPMAPlus.executeScript(BPMAPlus.java:196) at com.hyperion.bpma.cli.BPMAPlus.main(BPMAPlus.java:91)Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 8 more

Do you see anything obvious here? I do have Java_Home in the classpath.

When I moved some junit test classes from one package 2 another for testing purposes, Eclipse forgot where they were. I simply saved the class, then deleted it from eclipse and then rebuilt it. It worked!

Desperately Seeking Help!!I paid and downloaded a program from online which was 100% guaranteed with a 30 day moneyback guarantee, well thats a joke...what liars...this is what they have posted Q) I get an error message when I install it on my BlackBerry. What could have gone wrong?

A) If after transferring the files (which initiates all the actions given in its menu) it does not run or you get any error screen, for example “Uncaught Exception: Java.Lang.NoclassDeffound Error” or “error 907 invalid jar” then there has been some error in transferring the files correctly to your cell phone.

It won't be possible for us to pin-point exactly what has caused this without actually seeing the details.

There could be various causes for your files not getting transferred depending on your computer configuration.

There is a strong possibility that a pop-up blocker, your firewall settings, your spyware or anti-virus program or any similar app. is coming in the way of installation.

In this case you will have to let your computer engineer take a look at your computer settings and get the software transferred properly.

The name of the program is Cell-Spy_Brand_New_2011, they also guarateed it was guaranteed to work on almost any cell phone.I can give you the name of the files I don't know what else to do or how to do it...so sorry.

I get the application successfully installed on my phone, but when I try to run it, I get Uncaught Exception:java.lang.NoClassDefFoundError.Honestly I have been going almost 48 hrs straight trying to find a solution, any help at all would be so appreciated, and thanks so much.

java.lang.NoClassDefFoundError: org/vivoweb/harvester/util/DatabaseCloneCaused by: java.lang.ClassNotFoundException: org.vivoweb.harvester.util.DatabaseClone at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247)Could not find the main class: org.vivoweb.harvester.util.DatabaseClone. Program will exit.Exception in thread "main"

when i'm trying to execute jar file from .sh file. i'm tring to run that shell file through cygwin in windows, but it throws the above exception. don't know where the main problem is??is it related to library jar files that are being used by jar file i wanna execute???what i understand is that i'm not setting right classpath. can you please give me any suggestion???

When I run my program in Linux i get the following error, any idea / suggestion? Thanks

Exception in thread "main" java.lang.NoClassDefFoundError at java.awt.Event.(Event.java:581) at jet.controls.JetProperty.propertyChanged(jet/controls/JetProperty) at jet.controls.JetNumber.set(jet/controls/JetNumber) at jet.universe.JetUUniverse.(jet/universe/JetUUniverse) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:501) at java.lang.Class.newInstance0(Class.java:350) at java.lang.Class.newInstance(Class.java:303) at jet.jetc.JetCReader.$9cc(jet/jetc/JetCReader) at jet.jetc.JetCReader.read(jet/jetc/JetCReader) at jet.jetc.JetCReader.read(jet/jetc/JetCReader) at jet.jetc.ReportLoader.loadObject(jet/jetc/ReportLoader) at jet.jetc.ReportLoader.loadObject(jet/jetc/ReportLoader) at jet.jetc.ReportLoader.load(jet/jetc/ReportLoader) at jet.universe.JetUUniverse.$g3c(jet/universe/JetUUniverse) at jet.universe.JetUUniverse.LoadUniverse(jet/universe/JetUUniverse) at jet.universe.JetUUniverse.LoadUniverse(jet/universe/JetUUniverse) at jet.bean.JRCatalog.loadCatalog(jet/bean/JRCatalog)

Hi, I also meet the same situation today. I could run it successfully this morning, but after including some jquery script in one of my jsp files, it throws the following error information. After I deleting all the modifications I have made, it still has the following error information. Please help me. Thanks

SEVERE: Servlet.service() for servlet [AdminAuth] in context with path [/PowerConsumption] threw exception [Servlet execution threw an exception] with root causejava.lang.NoClassDefFoundError: src/Config at src.AdminAuth.service(AdminAuth.java:39) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

However the same application (without any changes) works fine in tomcat5.0.25 & java 1.6.0_21,java 1.5.0_20 (when compiled with java5) in SOLARIS expand »& on tomcat5.0.25 & java 1.6.0 on AIX.

Since the tomcat version is the same throught the different deployments i belive i need not check if there are multiple jars (in my application & in tomcat) containing the class javax.servlet.jsp.tagext.TagExtraInfo.

Also i checked in the JAVA_HOME/jre/lib & JAVA_HOME/jre/lib/ext folders to check if there are jars containing the class.I couldn't find any.

hi,I am trying to invoke a method in class remotely.and I am getting java.rmi.ServerError: Server exception; nested exception is: java.lang.NoClassDefFoundErrorIt does not come consistently by that I mean most of the times I am able to invoke that method and process goes through but once in a while it crashes with that error. What can cause this inconsistent behaviorthanks

Another common issue (not sure if this has been mentioned in the comments,there are 95+ and I'm not going to read them all), is that your .java file is written within a package, so when you compile it into a .class file, and for example a JApplet tries to render it on a website, it is no longer in the package so it won't render properly. This was an issue for me. Hopefully this helps someone :)

My classpath is set to C:\Program Files\Java\jre1.6.0\liband my TestMain.java is under "C:\Users\ACER\Documents". I tried to paste the TestMain.java in Java folder under Program Files but syill i m getting the same error. Please help me

I'm planning to consolidate and share common NoClassDefFoundError problem cases I have worked on last month for an IT client. I have part #1 available java.lang.NoClassDefFoundError: How to resolve and I’m hoping this will be a good complement to your great article on the subject. A good understanding of Java Classloaders is key to understand this problem in Java EE world so extra focus will be put on that.

I also want to add that your Blog has been a good inspiration for me to start writing and sharing on Java related problem patterns and I thank you for that.

Thank you very much for you post. I am getting this error for a simple thing which I am doing...

I installed jdk1.6.0_33 at 'C:\Program Files\Java\jdk1.6.0_33' in my system and I have jre6 at 'C:\Program Files (x86)\Java\jre6'. My path envrionment variable has ' C:\Program Files\Java\jdk1.6.0_33\bin' and classpath variable has 'C:\Program Files\Java\jdk1.6.0_33\lib'.

Now I just run javac from my command prompt in my Windows 7 system and I get -

Can you please guide me to solve this problem, I have already spent trying different configurations with my path, classpath variables. And I have also reinstalled it many times. But I still get this error.

I solved my problem. I reinstalled the Jre6 and jdk1.6.0_25 in the same Java Folder (i.e. C:\Program Files\Java). And set my path to"C:\Program Files\Java\jdk1.6.0_25\bin;C:\Program Files\Java\jre6\bin;C:\.;"

and JAVA_HOME to "C:\Program Files\Java\jdk1.6.0_25". I removed the classpath variable.

And my 'javac' command works. I think one of the reasons my javac command didn't work may be that:(i) My jdk and jre were in different folders. Now, I kept them in single folders.(ii) I reinstalled checking the ocrrect versions.

Hello, we are getting "Exception in thread "main" java.lang.NoClassDefFoundError: com/ximpleware/VTDGen", Its Java project with maven and vtd-xml is included in maven dependency. Please help with this NoClassDefFoundError.

Thanks for this article, a quick comment is java.lang.NoClassDefFoundError could also happen when your class fails while loading at runtime, for example you have a class with a static block which does some initialization work. so if static block throws any runtimeException then caller class will get the java.lang.NoClassDefFoundError exception.

Hi,I am developing a plugin to create/compile/run a CDT project using Eclipse. I am using CCorePlugin.getDefault().createCProject() api in my program. When I try to install my plugin and run, it gives the below error.java.lang.NoClassDefFoundError: org/eclipse/cdt/core/CCorePlugin at sourceanalysistoolplugin.wizards.CDTProjectManager.createCDTProj(CDTProjectManager.java:43) at sourceanalysistoolplugin.intermediate.SourceCompileManager.createProject(SourceCompileManager.java:38) at sourceanalysistoolplugin.actions.SATMenuCompileActionDelegate.run(SATMenuCompileActionDelegate.java:63) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410)Caused by: java.lang.ClassNotFoundException: org.eclipse.cdt.core.CCorePlugin at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at java.lang.ClassLoader.loadClass(Unknown Source) ... 32 more

I have added org.eclipse.cdt.core jar file in plugin dependencies.Could you please guide me to solve the problem.

Exception in thread "main" java.lang.NoClassDefFoundError:Caused by: java.lang.ClassNotFoundException: com.su.STSQLEditor at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248)Could not find the main class: com.su.STSQLEditor. Program will exit.

HiI am getting the follwoing errorException in thread "main" java.lang.NoClassDefFoundError: com/amdocs/pc/backend/aspects/SessionContextLoaderInterceptor at com.amdocs.pc.backend.utils.EPCSessionContextProvider.get(EPCSessionContextProvider.java:20) at com.amdocs.pc.backend.utils.EPCSessionContextProvider.getUserName(EPCSessionContextProvider.java:25) at com.amdocs.pc.backend.aspects.LoggerAspect.log(LoggerAspect.java:22) at org.slf4j.impl.EpcLogger.log(EpcLogger.java:515) at org.slf4j.impl.EpcLogger.log(EpcLogger.java:503) at org.slf4j.impl.EpcLogger.debug(EpcLogger.java:196)

Using Eclipse IDE . Once I realized that this error may occur during compile time I went to Project->Clean->Select Project you want to clean. What this will do is delete all the compiled files for the selected project and re-compile that project hopefully fixing any error that happened during last compile. Worked for me. Hope this helps

Thanks for sharing your experience Anonymous, Exception in thread "main" java.lang.NoClassDefFoundError has many ways to surface, recently I encounter in a totally different way. I create a tar file using cygwin and extracted on solaris box only to encounter Exception in thread "main" java.lang.NoClassDefFoundError, later I found that many class files has extension .cl or .clas or .cla especially those which have long package hierarchy. after using find command in solaris to find all those files and correcting them, application worked fine.

Caused by: java.lang.NoClassDefFoundError: Could not initialize class im at jk.b(SourceFile:94) at com.trapeze.appl.gp2.beans.ServerBean.getLearntSwitches(SourceFile:534) at com.trapeze.appl.gp2.beans.ServerBean.getLearntSwitchesExist(SourceFile:548) ... 152 more

jk and im are obfuscated classes that are in the same jar library.Can you please give me a hint about a possible root cause?

any body can help me to resolve this issue?it gets when i start my jboss.

pls reply @ patel_niket9@yahoo.co.in

09:59:36,017 WARN [verifier] EJB spec violation: Bean : PaymentGatewaySessionBeanSection: 22.2Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the element.Info : Class not found on 'com.session.PaymentGatewaySessionBean': Unexpected error during load of: com.session.PaymentGatewaySessionBean, msg=PermGen space

Thanks for this article. I had the same error with classes in a jar file. Now i copied the jar file to the libs folder and added it to the project. Thank god I am a happier man after 24 hours of confusion

Hello,I am trying to create a bindings file on windows server 2008 to script the MQ using loadrunner. The issue i am facing is that after installing the mq files and jdk on the server when i try to execute the JMSASdmin batch file i get the following error:Exception in thread "main"java.lang.NoClassDefFoundError: javax/jmsJMSException at java.lang.Class.forName0(NativeMethod) at java.lang.Class.forName(UnknownSource) at com.ibm.mq.MQEnvironment$2.run(MQEnvironment.java:557) at java.security.AccessController.doPrivileged(Native Method) at com.ibm.mq.MQEnvironment.(MQEnvironment.java:550) at com.ibm.mq.jms.services.ConfigEnvironment.(ConfigEnvironment.java:190) at com.ibm.mq.jms.admin.JMSAdmin.(JMSAdmin.java:195) at com.ibm.mq.jms.admin.JMSAdmin.main(JMSAdmin.java:1832)Caused by: java.lang.ClassNotFoundException: javax.jms.JMSException 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) ... 8 more

I have checked my classpath and it has the jms.jar file in it. I have tried reinstalling th mq files and jdk 7 on my machine multiple times but get the same error. I have done the exact same thing on my local desktop and it works fine. If anyone has any suggestions regarding this it would be a life saver.Thanks.

I'm working with MyEclipseWorkbench8.5 when I'm working with simple class files it is working fine but while working with the JDBC it is giving this following exceptionException:

in thread "main" java.lang.NoClassDefFoundError: java/sql/SQLClientInfoException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:213) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282) at java.sql.DriverManager.getConnection(DriverManager.java:548) at java.sql.DriverManager.getConnection(DriverManager.java:180) at com.Mytest.ConnectionPool.getConnection(ConnectionPool.java:17) at com.Mytest.DBTest.main(DBTest.java:15)

I have developed my project like this:1. I have given perfect database properties. 2. I have added corresponding jar file in classpath(with the above tutorial I have traced com.mysql.jdbc.Driver class also in the jar and I have attached same jar file to my project classpath)3. I have tested this code in some other system and it is working fine.

Please help me... When I run my test suite I am getting this error.. I tried all ways listed under http://code.google.com/p/testng-eclipse/issues/detail?id=43 and nothing worked for me..:( I am not using maven.

Hi, i suppose you are tired of questions on this topic, however, y wish you could check my error. Y have a thread on stackoverflow, on this link (y don't post the full log, i think this way is more confortable for you...): http://stackoverflow.com/questions/15650035/deployment-exception-while-creating-a-webservice-on-java-using-axis2

java.lang.NoClassDefFoundError at javax.crypto.Cipher.getInstance([DashoPro-V1.2-120198]) at coldfusion.compiler.TemplateReader.decrypt(Unknown Source) at coldfusion.compiler.TemplateReader.(Unknown Source) at coldfusion.compiler.NeoTranslationContext.getPageReader(Unknown Source) at coldfusion.compiler.NeoTranslator.translateJava(Unknown Source) at coldfusion.compiler.NeoTranslator.translateJava(Unknown Source) at coldfusion.runtime.TemplateClassLoader$1.fetch(Unknown Source) at coldfusion.util.LruCache.get(Unknown Source) at coldfusion.runtime.TemplateClassLoader$TemplateCache.fetchSerial(Unknown Source) at coldfusion.util.AbstractCache.fetch(Unknown Source) at coldfusion.util.SoftCache.get(Unknown Source) at coldfusion.runtime.TemplateClassLoader.findClass(Unknown Source) at coldfusion.filter.PathFilter.invoke(Unknown Source) at coldfusion.filter.LicenseFilter.invoke(Unknown Source) at coldfusion.filter.ExceptionFilter.invoke(Unknown Source) at coldfusion.filter.ClientScopePersistenceFilter.invoke(Unknown Source) at coldfusion.filter.BrowserFilter.invoke(Unknown Source) at coldfusion.filter.GlobalsFilter.invoke(Unknown Source) at coldfusion.filter.DatasourceFilter.invoke(Unknown Source) at coldfusion.CfmServlet.service(Unknown Source) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:241) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527) at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:198) at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:348) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451) at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:294) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

I wanted to install MATLAB on FC17_x64. I had a problem with installation but it somehow got installed successfully when i unchecked Aeromodeling toolbox. However, when i run matlab I am getting NoClassDefFoundError:

Exception in thread "main" java.lang.NoClassDefFoundError: com/mathworks/instwiz/arch/ArchGuiFactoryCaused by: java.lang.ClassNotFoundException: com.mathworks.instwiz.arch.ArchGuiFactory at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at sun.misc.Launcher$ExtClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source)Could not find the main class: com.mathworks.activationclient.ActivationApplication. Program will exit.=======================================

I am using a J2EE application with web and ejb modules.It is a struts-hibernate architecture.I have got exceptions like:1)Undefined alias2)missingResourceBundle exception:Resource bundle with base name jdbc can't be found.All these issues are classloader and classpath related.

I want to know the order and priorities in which jars will be available in application If its 1)In default webapp/lib directory 2)loaded by setDomain.env of weblogic 3)In weblogic-application.xml 4)In manifest.mfOr Called from anywhere..Please guide I am stuck. I have three folders in my project 1)EAR-CONTENT 2)ejb-module 3)webapps.I have jar files in application at 1)ear-content/APP-INF/lib 2)webapps/webcontents/webinf/lib

I have faced the same error java.lang.NoClassDefFoundError in catalina.out when starting tomcat.

I was trying to find the root cause and to fix the problem and unfortunately it found something very strange thing that I am getting the same error when there are few extra symbol added by mistake to $JAVA_OPTS.

Hi, I'm getting this error from today. The site was working fine for a litte time, I don't made any changes and I'm getting this error today. The host server said me that they didn't change anything, but I'm not getting this error locally, I'm using Ecilpse and Tomcat 6 and everything works fine locally. I read all your post but I'm not sure waht to do, I don't have the error at my computer, only on server side and nothing was changed, I really don't understand, I'm really new in Java Web developpment.My error is :type Exception report

Hello Marie, try restarting Tomcat, there is not much clue about the issue, but looks like problem with one of the JSP page, I would suggest using isolation method to debug e.g. try removing JSP one by one, to find the problematic one.

My error was due to ExceptionInInitializerError, but I didn't see this in the log. This is because my program executes hundreds of threads calling the culprit class, and only on the first time the ExceptionInInitializerError appears. All subsequent calls just give NoClassDefFoundError, which was what my console was spammed with.

I just wanted to mention that I encountered the NoClassDefFoundError on a project I was working on. The server being setup was using a different version of Java by IBM, rather than Oracle's. On my development machine it worked for me, but on the server I got that error. The issue was resolved once they redid Java using Oracle's version (and Tomcat as well). This may be the solution to someone's problem here as well to consider.

HI While calling WS through Junit i am getting below error, this error only occurs through Junit and not through application (i.e. after deployment on server)31-Jul-2013 13:14:41 com.ibm.ws.webservices.engine.WebServicesProperties$2 runWARNING: WSWS3227E: Error: Exception:java.lang.InstantiationException: javax.xml.parsers.SAXParserFactory at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1300)any idea please?

I got the below error when i try to start my WAS 7.0 using RAD, previously it was working good, after i restart my system it gives the error. Please help.

Exception in thread "main" java.lang.NoClassDefFoundError: Files\IBM\SDP\runtimes\base_v7\profiles\AppSrv08.properties.wsjaas.conf -Djava.security.policy=D:\ProgramCaused by: java.lang.ClassNotFoundException: Files\IBM\SDP\runtimes\base_v7\profiles\AppSrv08.properties.wsjaas.conf -Djava.security.policy=D:\Program at java.net.URLClassLoader.findClass(URLClassLoader.java:434) at java.lang.ClassLoader.loadClass(ClassLoader.java:660) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358) at java.lang.ClassLoader.loadClass(ClassLoader.java:626)Could not find the main class: Files\IBM\SDP\runtimes\base_v7\profiles\AppSrv08/properties/wsjaas.conf -Djava.security.policy=D:\Program. Program will exit.

Any idea, how to fix below error java.lang.NoClassDefFoundError: Could not initialize class com.tibco.tibrv.TibrvMsg, it's coming during building our application using Jenkins and due to this error lots of unit tests are failing.

I found one another common reason. If you create the java file inside a package using IDE like eclipse, you will find the package name on the top of your java file like "package pkgName". If you try to run this file from command prompt, you will get the NoClassDefFoundError error. Remove the package name from the java file and use the commands in the command prompt. Wasted 3 hours for this. -- Abhi

I am facing this error when i create jar file and try to execute it with a .bat file. I have placed the classpath and varified it which dead correct.

ERROR - Exception in PWCApplicationInitiator - applicationinitiator.PWCApplicationInitiator 67 mainjava.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) 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$000(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 com.matrixone.apps.domain.util.PropertyUtil.getProperty(PropertyUtil.java:88) at com.matrixone.apps.domain.util.ContextUtil.runInAnonymousContext(ContextUtil.java:287) at com.matrixone.apps.domain.DomainObject.(DomainObject.java:139) at com.pwc.dataloader.PWCSpinnerLoader.getRevisionForIPEC(PWCSpinnerLoader.java:491) at com.pwc.dataloader.PWCSpinnerLoader.loadClassificationInformationSpinner(PWCSpinnerLoader.java:422) at com.pwc.dataloader.PWCSpinnerLoader.loadClassificationInformationRelationshipSpinner(PWCSpinnerLoader.java:318) at com.pwc.dataloader.PWCSpinnerLoader.loadRelationshipDataToSpinner(PWCSpinnerLoader.java:80) at com.pwc.dataloader.PWCRFALoader.processMigUnitWrapper(PWCRFALoader.java:39) at com.pwc.applicationinitiator.PWCApplicationInitiator.configureInstance(PWCApplicationInitiator.java:93) at com.pwc.applicationinitiator.PWCApplicationInitiator.main(PWCApplicationInitiator.java:61)Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet 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) ... 22 more

java.lang.NoClassDefFoundError: Could not initialize class com.cordys.esbinternal.r1.CopyBookDefaultsCacheManager at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.eibus.xml.xpath.XPathMetaInfo.executeCustomFunction(XPathMetaInfo.java:386) at com.eibus.xml.xpath.XPath.evaluateAsXPathResult1(Native Method) at com.eibus.xml.xpath.XPath.evaluate(XPath.java:656) at com.cordys.bpm.utils.xpathevaluator.XPathEvaluatorUtil.evaluateXPathExpr(XPathEvaluatorUtil.java:50) at com.cordys.bpm.utils.xpathevaluator.XPathEvaluator.evaluateXPath(XPathEvaluator.java:72) at com.cordys.bpm.utils.xpathevaluator.EvaluateXPathSOAPRequestHandler.processRequest(EvaluateXPathSOAPRequestHandler.java:112) at com.cordys.bpm.service.BPMSOAPTransaction.process(BPMSOAPTransaction.java:48) at com.eibus.soap.SOAPTransaction.handleBodyBlock(SOAPTransaction.java:1379) at com.eibus.soap.SOAPTransaction.(SOAPTransaction.java:574) at com.eibus.soap.SOAPTransaction.(SOAPTransaction.java:238) at com.eibus.soap.Processor.onReceive(Processor.java:1066) at com.eibus.soap.Processor.onReceive(Processor.java:1039) at com.eibus.connector.nom.Connector.onReceive(Connector.java:475) at com.eibus.transport.NonTransactionalWorkerThreadBody.doWork(NonTransactionalWorkerThreadBody.java:61) at com.eibus.transport.NonTransactionalWorkerThreadBody.run(NonTransactionalWorkerThreadBody.java:26) at com.eibus.util.threadpool.WorkerThread.run(WorkerThread.java:64)

[12/24/13 17:05:47:199 IST] 00000032 annotation W com.ibm.ws.webcontainer.annotation.WASAnnotationHelper collectClasses unable to instantiate class java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagSupport at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:299) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:363) at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:347) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83) at java.lang.ClassLoader.loadClass(ClassLoader.java:299) at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:111) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62) at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58) at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at com.ibm.ws.webcontainer.annotation.WASAnnotationHelper.loadClass(WASAnnotationHelper.java:725) at com.ibm.ws.webcontainer.annotation.WASAnnotationHelper.collectClasses(WASAnnotationHelper.java:519) at com.ibm.ws.webcontainer.annotation.WASAnnotationHelper.(WASAnnotationHelper.java:140) at com.ibm.ws.webcontainer.annotation.WASAnnotationHelperManager.getAnnotationHelper(WASAnnotationHelperManager.java:59) at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:247) at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:100) at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:166) at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:732) at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:617)

Exception in thread "main" java.lang.NoClassDefFoundError: bankCaused by: java.lang.ClassNotFoundException: bank at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268)Could not find the main class: bank. Program will exit.

Jan 30, 2014 11:17:04 AM org.zkoss.zk.ui.impl.UiEngineImpl handleErrorSEVERE: java.lang.NoClassDefFoundError: javax/mail/Address at com.akarprima.kambium.view.controller.LeaveController$1.onEvent(LeaveController.java:121) at com.akarprima.kambium.view.controller.LeaveController$1.onEvent(LeaveController.java:1) at org.zkoss.zul.impl.MessageboxDlg.endModal(MessageboxDlg.java:107) at org.zkoss.zul.impl.MessageboxDlg$Button.onClick(MessageboxDlg.java:154) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2728) at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2663) at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136) at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1765) at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1550) at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1260) at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:603) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:485) at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:494) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)Caused by: java.lang.ClassNotFoundException: javax.mail.Address at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) ... 38 more

Hello anonymous, only include relevant log4j jar files (version 2.) , that would resolve this error. I have also encountered same error Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder, I had removed all of the log4j jar files except :"log4j-api-2.0-beta9.jar" and "log4j-core-2.0-beta9.jar",this has resolved the problem for me.

Hello I am getting the NoclassFound error in my java GUI application using 'swing' only when I run on Oracle Linux 5\6 platform. I do not get this error on any windows OS so not sure what's going on...Has anyone seen this before

Getting below NoClassDefFoundError while trying to send email from Java program. I do have all the JAR required for sending email e.g. mail-1.4.5.jar , smtp-1.4.4..jar and activiation-1.1.jar but still getting below exception : Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2521) at java.lang.Class.getMethod0(Class.java:2764) at java.lang.Class.getMethod(Class.java:1653) at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

I managed to resolve my problem, it was because of incorrect classpath. Even though I had all three required JAR and Java class file for program in same directory and I am running program from there, Java wasn't able to resolve that. I tried following command and it worked perfectly for me :

Is there someone having the NoClassDefFoundError using shared folders in Virtualbox?

I have had a weird situation here. There are three virtual machines (two WinXP, one Win7) in my development machine, and in one of the WinXP machines I can't run jar files that are located in shared folders by Virtualbox (just the virtualbox folder, not the real ones), they crash with the NoClassDefFoundError error. In the other two machines works well, the same shared folder, the same jar, compiled with Netbeans with propper manifest and lib folder, under the same java version 1.7.0_51.

I am trying to create an end-point (JMS) for my middleware performance testing in IBM Rational Performance Tester. The following are the steps that I have followed for using JMS .jar files for TIBCO EMS Middleware Web Services, with the 'How to change the default JMS libraries in IBM Rational Performance Tester Technote (FAQ)' document as reference.

1. Changed the jar files as per the doc attached since the protocol used it TIBCO EMS (JMS).2. Clicking the generic services client -> add an end point request.

When I do this, I am getting the java.lang.NoClassDefFoundError in the exception trace log and am not able to proceed.

Kindly provide your suggestions or solutions, to identify the root cause of the issue and to solve the same, in order to proceed further.

I am trying to run a program which suppose to create files in current directory but I am getting following error when running the class from command prompt:

java -cp . TempFileDemo

Exception in thread "main" java.lang.NoClassDefFoundError: FileNotFoundException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2521) at java.lang.Class.getMethod0(Class.java:2764) at java.lang.Class.getMethod(Class.java:1653) at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)Caused by: java.lang.ClassNotFoundException: FileNotFoundException at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 6 more

- Exception in CompatabilityFilterjavax.servlet.ServletException: java.lang.NoClassDefFoundError: net.sf.cglib.proxy.Enhancer (initialization failure) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:239) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89) at com.fisglobal.CompatabilityFilter.doFilter(CompatabilityFilter.java:28) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:926) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1023) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3703) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:522) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:311) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:87) at

i am using httpmime jar files for Multipartentity for image upload and getting this NoClassDefFoundError

E/AndroidRuntime(1116): FATAL EXCEPTION: main Process: crawes.product.iagent, PID: 1116 java.lang.NoClassDefFoundError: org.apache.http.entity.mime.MultipartEntity at crawes.product.iagent.AddProduct.upload(AddProduct.java:186) at crawes.product.iagent.AddProduct.onClick(AddProduct.java:143) at android.view.View.performClick(View.java:4438) at android.view.View$PerformClick.run(View.java:18422) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method)

I get this error when trying to deploy on a unix box but no issues on my local weblogic server.User defined listener org.springframework.web.context.ContextLoaderListener failed: java.lang.NoClassDefFoundError: org/quartz/spi/ClassLoadHelper. java.lang.NoClassDefFoundError: org/quartz/spi/ClassLoadHelper at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2532) at java.lang.Class.getDeclaredConstructors(Class.java:1901) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:191) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:859) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:831) at

I am getting java.lang.NoClassDefFoundError:org/objectweb/asm/ClassVisitor when running Cobetura using ant. This issue is faced only one particular machine, the same is not reproducible when ran on other machines.Checked the classpath and the asm jar file is available in the classpath. Only option i have is uninstall the jdk1.6.0_x and install next version.

Sometime, when you move from one version to another of same library or change the JAR file, you start getting this error, because earlier version was including a dependent JAR which is not includeded by newer version. To find out those dependent jar, you can take help of maven transitive dependency. If you are using Eclipse and Maven then you can check these trasitive depedency in Eclipse POM editor, alternatively you can also use mvn dependency:tree to see all transitive dependency in tree format. This is very helpful tool and helped me a lot to deal with NoClassDefFoundError due to update.

I am currently stuck at this problem and cannot find a solution. Appreciate your help.

Exception in thread "main" java.lang.NoClassDefFoundError: oracle/help/library/Book at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2693) at java.lang.Class.privateGetMethodRecursive(Class.java:3040) at java.lang.Class.getMethod0(Class.java:3010) at java.lang.Class.getMethod(Class.java:1776) at ndi.util.Spawner.localSpawn(Spawner.java:167) at ndi.util.Spawner.spawn(Spawner.java:103) at Config.main(Config.java:18)Caused by: java.lang.ClassNotFoundException: oracle.help.library.Book at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 8 more