Friday, July 30, 2021

3 ways to solve java.lang.NoClassDefFoundError in Java J2EE

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 a couple of times and spent quite a lot of time initially to figure out what is wrong, which class is missing etc. The first mistake I did was mingling java.lang.ClassNotfoundException and NoClassDefFoundError, in reality, are totally different, and my second mistake was using the trial and error method to solve this java.lang.NoClassDefFoundError instead of understanding why NoClassDefFoundError is coming, what is the 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 that cannot be resolved or is hard to resolve it’s just its manifestation that puzzles most Java developers. 

This is the most common error in Java development along with java.lang.OutOfMemoroyError: Java heap space and java.lang.OutOfMemoryError: PermGen space  Anyway lets see Why NoClassDefFoundError comes in Java and what to do to resolve NoClassDefFoundError in Java.





What is the reason for NoClassDefFoundError in Java?

NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available at 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 ClassNotFoundException which comes while trying to load a class at run-time only and the name was provided during runtime, not at compile-time. Many Java developer mingles 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 the below line in the log when you get NoClassDefFoundError:

Exception in thread "main" java.lang.NoClassDefFoundError

Exception in thread “main” simply indicates that it's the “main” thread that is not able to find a particular class it could be any thread so just don’t worry. The difference between this error coming in the main thread and another thread is when Exception in thread “main” comes program crashes or shut itself down as opposed to other thread in which case your program will continue to run. 

If you are really curious and think that you understand how class loading works, I suggest you try some puzzles from Joshua Bloch's Java Puzzlers, it has got some really tricky questions to test your knowledge.



The difference between java.lang.NoClassDefFoundError and ClassNotFoundException in Java

Many times we confused ourselves with java.lang.ClassNotFoundException and java.lang.NoClassDefFoundError, though both of them are related to Java Classpath they are completely different from each other. 

ClassNotFoundException comes when JVM tries to load a class at runtime dynamically means you give the name of the class at runtime and then JVM tries to load it and if that class is not found in the classpath it throws java.lang.ClassNotFoundException. 

While in the case of NoClassDefFoundError the problematic class was present during Compile time and that's why the program successfully compiled but was not available during runtime for any reason. 

NoClassDefFoundError is easier to solve than ClassNotFoundException in my opinion because here we know that Class was present at build time, but it totally depends upon the environment if you are working in the J2EE environment then you can get NoClassDefFoundError even if the class is present because it may not be visible to the corresponding class loader. See my post NoClassDefFoundError vs ClassNotFoundException in Java for more details.





How to resolve java.lang.NoClassDefFoundError in Java

java.lang.NoClassDefFoundError in Java solutionThe obvious reason for NoClassDefFoundError is 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:

1) The class is not available in Java Classpath.

2) You might be running your program using the jar command and class was not defined in the manifest file's ClassPath attribute.

3) Any start-up script is an overriding Classpath environment variable.
4) Because NoClassDefFoundError is a subclass of java.lang.LinkageError it can also come if one of it dependency like native library may not available.

4) Check for java.lang.ExceptionInInitializerError in your log file. NoClassDefFoundError due to the failure of static initialization is quite common.

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

We will now see a couple of examples and scenarios when java.lang.NoClassDefFoundError has come before and how it's been resolved. This can help you to troubleshoot the root cause of NoClassDefFoundError in Java application.

How to solve NoClassDefFoundError in Java


NoClassDefFoundError in Java - Example and Scenarios

1. A simple example of NoClassDefFoundError is class belongs to a missing JAR file or JAR was not added into classpath or sometimes jar's name has been changed by someone like in my case one of my colleagues has changed tibco.jar into tibco_v3.jar and the program is failing with java.lang.NoClassDefFoundError and I were wondering what's wrong.

2. The class is not in Classpath, there is no sure-shot way of knowing it but many 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 it's working then it's a sure shot sign that someone is overriding java classpath.

NoClassDefFoundError in Java due to Exception in Static Initializer block

This is another common reason for java.lang.NoClassDefFoundError, when your class performs some static initialization in a static block like many Singleton classes initialized itself on the static block to take advantage of thread-safety provided by JVM during the class initialization process, and if static block throws 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.ExceptionInInitializerError because that could trigger java.lang.NoClassDefFoundError: Could not initialize class on other places. 

Like in the below code example, During class loading and initialization User class are throwing Exception from the static initializer block, which triggers ExceptionInInitializerError during the first time loading of User class in response to new User() call.

Later rest of new User() are failing as java.lang.NoClassDefFoundError. the situation gets worst if original ExceptionInInitializerError, which is root cause here is silently eaten by any code.


Code Example of NoClassDefFoundError due to Static block Exception:


/**
 * Java program to demonstrate how failure of static initialization subsequently cause
 * java.lang.NoClassDefFoundError in Java.
 * @author Javin Paul
 */

public class NoClassDefFoundErrorDueToStaticInitFailure {

   
public static void main(String args[]){
       
        List
<User> users = new ArrayList<User>(2);
       
       
for(int i=0; i<2; i++){
           
try{
            users.
add(new User(String.valueOf(i))); //will throw NoClassDefFoundError
           
}catch(Throwable t){
                t.
printStackTrace();
           
}
       
}        
   
}
}

class User{
   
private static String USER_ID = getUserId();
   
   
public User(String id){
       
this.USER_ID = id;
   
}
   
private static String getUserId() {
       
throw new RuntimeException("UserId Not found");
   
}    
}

Output
java.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 more
java.lang.NoClassDefFoundError: Could not initialize class testing.User
    at testing.NoClassDefFoundErrorDueToStaticInitFailure.main(NoClassDefFoundErrorDueToStaticInitFailure.java:23)


5) Since NoClassDefFoundError is an also a LinkageError that arises due to dependency on some other class, you can also get java.lang.NoClassDefFoundError if your program is dependent on the native library and the 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 the ANT build file create JAR and manifest file then its worth noting to debug till that level to ensure that ANT build script is getting the correct value of classpath and appending it to manifest.mf file.

7) Permission issue on the JAR file can also cause NoClassDefFoundError in Java. If you are running your Java program in a multi-user operating system like Linux then you should be using the application user id for all your application resources like JAR files, libraries, and configuration. 

If you are using a shared library which is shared among multiple application which runs under different users then you may run into permission issue, like JAR file is owned by some other user and not accessible to your application.

One of our readers “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 a dependency on the wrongly named bean. 

This is quite common in the 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 the same package while loading like in the case of JApplet it will throw NoClassDefFoundError in Java. Also, see Nick’s comment on this error.


10) java.lang.NoClassDefFoundError can be caused due to multiple classloaders in J2EE environments. Since J2EE doesn’t mention standard classloader structure and it depends on 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 the J2EE application knowledge of How ClassLoader works in Java is mandatory. Just to recap ClasLoader works on three principles delegation, visibility, and uniqueness. 

Delegation means every request to load a class is delegated to the parent classloader, visibility means an ability to found classes loaded by the classloader, all child classloaders can see classes loaded by parent classloader, but parent classloader can not see the class loaded by child classloaders. 

Uniqueness enforces that class loaded by the parent will never be reloaded by child classloaders. Now suppose if a class says User is present in both WAR file and EJB-JAR file and loaded by WAR classloader which is child classloader which loads the class from EJB-JAR. When a code in EJB-JAR refers to this User class, Classloader which loaded all EJB class doesn’t found that because it was loaded by WAR classloader which is a child of it. 

This will result in java.lang.NoClassDefFoundError for User class. Also, If the class is present in both JAR file and you will call equals method to compare those two objects, it will result in ClassCastException as the object loaded by two different classloaders can not be equal.



11) Some of the readers of this blog also suggested that they get Exceptions 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 reinstalling JDK? 

If you are getting this error try to reinstall JDK. One of our readers got this issue after installing jdk1.6.0_33 and then reinstalling JDK1.6.0_25, he also has his JRE and JDK in a different folder. See his comment also by searching JDK1.6.0_33.


12) Java program can also throw java.lang.NoClassDefFoundError during linking which occurs during class loading in Java. One of the examples of this scenario is just deleted 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.NoClassDefFoundError directly without  java.lang.ExceptionInInitializerError and message for NoClassDefFoundError are also just printing the name of the class as testing/User i.e. User class from the testing package. Watch out for this carefully as here root cause is absent of User.class file.

java.lang.NoClassDefFoundError: testing/User
    at testing.NoClassDefFoundErrorDueToStaticInitFailure.main(NoClassDefFoundErrorDueToStaticInitFailure.java:23)


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


Other Exception and Error handling Tutorials from Javareivisted

237 comments :

«Oldest   ‹Older   201 – 237 of 237
racs said...

How to fix the java.lang.NoClassDefFoundError for Static class called from the method of another class

I am getting throwable="java.lang.NoClassDefFoundError: Could not initialize class org.imgscalr.Scalr


when doing
BufferedImage image = Scalr.resize(....) where resize is a static method;

Unknown said...

Hello friends.
I have a web application using a biometric reader DigitalPersona.
In local mode everything works fine, but in production get the following error when making the comparison of fingerprints.
java.lang.unsatisfiedLinkError:com.digitalpersona.onetouch.jni.MatchingLibrary.init()V, and
java.lang.NoClassDeffoundError:Could not initialize class com.digitalpersona.onetouch.jni.Matcher.
footprint get through an applet, I can read and write it well, but when comparing send me the error mentioned. only in production.
I appreciate your suggestions.
I am using glassfish, jsf, hibernate and PrimeFaces

Anonymous said...

I am getting java.lang.NoClassDefFoundError: java/util/HashMap$Entry in Java SE 8, what could be the reason? When I switched back to Java SE 6, the error got resolved automatically.

Anonymous said...

Hi,
I am using eclipse 2.0, JVM 1.7 for my java applications.
When I am trying to use any jar files it is showing NoClassDefFoundException.
I have imported my jar file to my project.


This is my log report:

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at com.github.javafaker.Faker.(Faker.java:29)
at api_test.Test1.main(Test1.java:10)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
help me to get out of this problem.
Thanks in advance.

Anonymous said...

getting this error while calling java from oracle database error is like this: java.sql.SQLException: ORA-29532: Java call terminated by uncaught Java exception: java.lang.NoClassDefFoundError
It is not giving which class is not found.

Unknown said...

I Am getting java.lang.NoClassDefFoundError: org/drools/core/command/runtime/rule/FireAllRulesCommand. Even though the same code works fine with the same jar in my teammate's system. COuld you please help.

Unknown said...

Hi i am getting this error can you please guide me to how to resolve this issue
java.lang.NoClassDefFoundError: org/eclipse/debug/core/ILaunchListener
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetPublicMethods(Unknown Source)
at java.lang.Class.getMethods(Unknown Source)
at cucumber.runtime.java.MethodScanner.scan(MethodScanner.java:40)
at cucumber.runtime.java.JavaBackend.loadGlue(JavaBackend.java:89)
at cucumber.runtime.Runtime.(Runtime.java:90)
at cucumber.runtime.Runtime.(Runtime.java:68)
at cucumber.runtime.Runtime.(Runtime.java:64)
at cucumber.api.junit.Cucumber.createRuntime(Cucumber.java:78)
at cucumber.api.junit.Cucumber.(Cucumber.java:58)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: org.eclipse.debug.core.ILaunchListener
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)
... 29 more

Unknown said...

Hello, I am very new to java.I am working on couple software to re-establish a school project. [Activemq,vert.x,groovy,gradle,tomcat]83 tests failed after running command "gradle clean build" in cmd.They are mainly :java.lang.NoClassDefFoundError , java.lang.AssertionError , java.lang.ExceptionInInitializerError.
HERE IS ONE OF THEM:
java.lang.NoClassDefFoundError: Could not initialize class scp.targets.activemq.clustered.CommunicationManagerImplTest
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:195)
at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:244)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:241)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
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 org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:109)
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 org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:377)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Hopefully my info will make sense.Any suggestions?

javin paul said...

Problem looks like inside CommunicationManagerImplTest, it has some dependency which might not be available on classpath. focus on this class, you may able to find more info and root cause.

anil said...

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at com.symmetricom.databaseservice.DBStatus.(DBStatus.java:79)
at com.symmetricom.databaseservice.DBStatus$4.run(DBStatus.java:634)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
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)
... 16 more

Rick said...

run:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: bank/javaconnect
at bank.Account.(Account.java:28)
at bank.Account$6.run(Account.java:471)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ClassNotFoundException: bank.javaconnect
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 16 more


Anny suggestions how to fix this bug?

Anonymous said...

Hi, im getting NoClassDefFoundError, i have deployed in glassfish 3,

----------END server-side stack trace---------- vmcid: OMG minor code: 2 completed: Maybe
javax.ejb.EJBException: java.rmi.RemoteException: CORBA UNKNOWN 1330446338 Maybe; nested exception is:
org.omg.CORBA.UNKNOWN: ----------BEGIN server-side stack trace----------
org.omg.CORBA.UNKNOWN: WARNING: IOP00010002: Unknown user exception thrown by the server - exception: java.lang.NoClassDefFoundError; message: Lza/co/interfile/schemas/te/cardnotpresent/PaymentOption; vmcid: OMG minor code: 2 completed: Maybe
at sun.reflect.GeneratedConstructorAccessor113.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
at com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
at com.sun.proxy.$Proxy141.runtimeexception(Unknown Source)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.convertThrowableToSystemException(CorbaMessageMediatorImpl.java:1843)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleThrowableDuringServerDispatch(CorbaMessageMediatorImpl.java:1793)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleThrowableDuringServerDispatch(CorbaMessageMediatorImpl.java:1758)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:255)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1624)
at com.sun.corba.ee.impl.protocol.SharedCDRClientRequestDispatcherImpl.marshalingComplete(SharedCDRClientRequestDispatcherImpl.java:126)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:273)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:200)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
at com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenStubBase.invoke(CodegenStubBase.java:227)
at za.co.interfile.client.__MyGateEnterpriseService_Remote_DynamicStub.processPaymentCNP(za/co/interfile/client/__MyGateEnterpriseService_Remote_DynamicStub.java)
at za.co.interfile.client._MyGateEnterpriseService_Wrapper.processPaymentCNP(za/co/interfile/client/_MyGateEnterpriseService_Wrapper.java)
at za.co.interfile.bank.te.cnp.CardPaymentServer.processPayment(CardPaymentServer.java:189)
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 org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5388)

Test Blog said...

Hi Team,
I am getting below statements while running java code on unix using java commands.

Exception in thread "main" java.lang.NoClassDefFoundError:
at com.fairisaac.fraud.rulereport.RuleReport.main(RuleReport.java:180)
Caused by: java.lang.ClassNotFoundException: com.oroinc.text.regex.Pattern

Note:
I have recently installed a new Java version but this script is not even referring that Java. Still it seems to be interfering

Anonymous said...

Hi,

I am getting error
[10/9/17 2:17:30:266 CDT] 0000009e ServletWrappe E com.ibm.ws.webcontainer.servlet.ServletWrapper service Uncaught service() exception thrown by servlet BCBServlet: java.lang.NoSuchMethodError: org/apache/http/entity/InputStreamEntity.(Ljava/io/InputStream;Lorg/apache/http/entity/ContentType;)V
at com.cerner.tw.mo.TWxHttpClient.doTransaction(TWxHttpClient.java:233)
at com.cerner.tw.mo.MillenniumClient.doTransaction(MillenniumClient.java:186)
at com.cerner.tw.mo.TwObjectsMgr.executeRequest(TwObjectsMgr.java:68)
at com.cerner.tw.mo.Encounters.getEncntrByAliasFilter(Encounters.java:175)
at com.cerner.tw.cps.bcbservice.BCBServlet.processRequest(BCBServlet.java:168)
at com.cerner.tw.cps.bcbservice.BCBServlet.doGet(BCBServlet.java:273)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1232)

i tried adding different versions of http ocre jar file but it didn't worked.
Do i need to add some other jars.

appreciate your help!!

Anonymous said...

I am receiving below error. Any input is appreciated

Error 500--Internal Server Error

java.lang.NoClassDefFoundError: blackline/WSClient
at jsp_servlet.__blackline._jspService(__blackline.java:152)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3739)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3705)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2282)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2181)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1491)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

Symphonance said...

Hi,

I am project manager and we have currently a major problem.

Locally our build is working fine.
We deployed it on our dev environment which has a domain controler and 2 host. The deployment works fine there has well. We have deployed it on our client QA environment and didn't have problem neither. But on the staging environment, we are not able to deploy it, we are receiving the error NoClassDefFound at the persistenceunit ( JBAS014671: Failed services" => {"jboss.persistenceunit....). It is always the same build. The environment is build exactly the same way as the others with domain controler and hosts. Nothing major has changed in that build. Then we undeploy and deploy the old build which is the same application with just few differences (nothing new in configs), the old build works fine on that staging environment but the new build doesn't. It works on all other environments. Of course it is a showstopper for production deployment. We can not try that on production. Can you help? have you seen something like this before? do you have some recommendations?

javin paul said...

Hello Symphonance, I can understand your problem because it's really tough to solve these kind of issues and troubleshoot as very environment specific. When NoClassDefFoundError comes means a certain class is not available, first found that class name and search in your old build, because it's working it should be there. Then try to find why it's not present in the new build, a WAR or JAR file.

Symphonance said...

Yes the problem is that all class are there. We have compared each files of the 2 builds. Also as mentioned, the build is working fine on 3 others environment without any problem.

elad said...

I had the same exception - but only while running in debug mode,
this is how I solved the problem (after 3 whole days):
in the build.gradle i had : "multiDexEnabled true" set in the defaultConfig section.
defaultConfig {
applicationId "com.xxx.yyy"
minSdkVersion 15
targetSdkVersion 28
versionCode 5123
versionName "5123"
// Enabling multidex support.
multiDexEnabled true
}

but apparently this wasn't enough.
but when i changed:

public class MyAppClass extends Application

to:

public class MyAppClass extends MultiDexApplication

this solved it.
hope this will help someone

Unknown said...

I got the java.lang.NoClassDefFoundError while my process running several days. When restart the process, I can not recurring the problem. Please, give me a hand! Thanks!

Unknown said...

I get this error. When my project(project1) have dependency on third party library(dependency1). And that third party library have dependency on other third party library.(dependency2). Dependency 1 and Dependency 2 included in Pom.XML and after inclusion some other developer exclude that dependency. Project 1 uses static methods of dependency 1 class. But it fails to load the dependency 2 at run time loading. So after first failure. For other use of dependency 1 static class. It gives NoClassDefFoundError. So for solving this removed exclusion part.

Unknown said...

I am not able to resolve this error. can soem1 help me with it?

script said...

Cant find my problem.

Process: com.androiddeft.loginandregistration, PID: 21778
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5459)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5011)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4951)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1560)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5765)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/com.androiddeft.loginandregistration-2/base.apk", zip file "/data/app/com.androiddeft.loginandregistration-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.androiddeft.loginandregistration-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.androiddeft.loginandregistration-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.androiddeft.loginandregistration-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.androiddeft.loginandregistration-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.androiddeft.loginandregistration-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.androiddeft.loginandregistration-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.androiddeft.loginandregistration-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.androiddeft.loginandregistration-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.androiddeft.loginandregistration-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.androiddeft.loginandregistration-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.androiddeft.loginandregistration-2/lib/arm, /data/app/com.androiddeft.loginandregistration-2/base.apk!/lib/armeabi-v7a, /data/app/com.androiddeft.loginandregistration-2/split_lib_dependencies_apk.apk!/lib/armeabi-v7a, /data/app/com.androiddeft.loginandregistration-2/split_lib_slice_0_apk.apk!/lib/armeabi-v7a, /data/app/com.androiddeft.loginandregistration-2/split_lib_slice_1_apk.apk!/lib/armeabi-v7a, /data/app/com.androiddeft.loginandregistration-2/split_lib_slice_2_apk.apk!/lib/armeabi-v7a, /data/app/com.androiddeft.loginandregistration-2/split_lib_slice_3_apk.apk!/lib/armeabi-v7a, /data/app/com.androiddeft.loginandregistration-2/split_lib_slice_4_apk.apk!/lib/armeabi-v7a, /data/app/com.androiddeft.loginandregistration-2/split_lib_slice_5_apk.apk!/lib/armeabi-v7a, /data/app/com.androiddeft.loginandregistration-2/split_lib_slice_6_apk.apk!/lib/armeabi-v7a, /data/app/com.androiddeft.loginandregistration-2/split_lib_slice_7_apk.apk!/lib/armeabi-v7a, /data/app/com.androiddeft.loginandregistration-2/split_lib_slice_8_apk.apk!/lib/armeabi-v7a, /data/app/com.androiddeft.loginandregistration-2/split_lib_slice_9_apk.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)

jyothsna said...

Hi, can anyone suggest reasons for below error:
java.lang.NoClassDefFoundError: oracle/dss/graph/CustomToolTipCallback
at com.datanomic.director.resultsbrowser.client.ViewPanel.renderGraph(ViewPanel.java:1347)
at com.datanomic.director.resultsbrowser.client.ViewPanel.configureGraph(ViewPanel.java:1328)
at com.datanomic.director.resultsbrowser.client.graphing.GraphingPopupMenu.actionPerformed(GraphingPopupMenu.java:70)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
Caused by: java.lang.ClassNotFoundException: oracle.dss.graph.CustomToolTipCallback
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)
at com.datanomic.director.resultsbrowser.client.ViewPanel.renderGraph(ViewPanel.java:1347)
at com.datanomic.director.resultsbrowser.client.ViewPanel.configureGraph(ViewPanel.java:1328)
at com.datanomic.director.resultsbrowser.client.graphing.GraphingPopupMenu.actionPerformed(GraphingPopupMenu.java:70)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

javin paul said...

@Jyotsana, do you have the JAR file for this library in classpath?

Anonymous said...

Hi,
Great blog!
I am struggling with same issue java.lang.NoClassDefFoundError: exception and has posted a question. Please have a look:
https://stackoverflow.com/questions/55936183/test-are-skipped-when-running-via-batch-file-but-are-executing-on-eclipse-ide?noredirect=1#comment98557235_55936183

Unknown said...

this is my error on IntelliJ:
/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:64080,suspend=y,server=n -javaagent:/Users/mariana/Library/Caches/IdeaIC2019.2/captureAgent/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "/Users/mariana/IdeaProjects/HelloProcessingWorld/out/production/HelloProcessingWorld:/Applications/Processing 2.app/Contents/Java/core/library/core.jar:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar" MainApp
Connected to the target VM, address: '127.0.0.1:64080', transport: 'socket'
java.lang.NoClassDefFoundError: com/apple/eawt/QuitHandler
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3167)
at java.base/java.lang.Class.getMethodsRecursive(Class.java:3308)
at java.base/java.lang.Class.getMethod0(Class.java:3294)
at java.base/java.lang.Class.getMethod(Class.java:2107)
at processing.core.PApplet.runSketch(PApplet.java:10855)
at processing.core.PApplet.main(PApplet.java:10650)
at MainApp.main(MainApp.java:5)
Caused by: java.lang.ClassNotFoundException: com.apple.eawt.QuitHandler
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 8 more
Disconnected from the target VM, address: '127.0.0.1:64080', transport: 'socket'

Process finished with exit code 1
PLEASE HELP ME!!!

Pavan said...

Hi
I got javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class
in production env after long back, nothing changes in application since 2 years but got this error suddenly, i have redeployed war again but getting same issue.
Any idea how to resolve and what was the issue ? kindly help me anyone having idea

shivali said...

Hi,
this is the issue i am facing:-
2019-10-29 10:11:19,347 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/shsg].[com.sopra.banking.compliance.shsg.ui.rest.jaxrs.application.JaxrsApplication]] (http-192.88.192.113:7004-2) JBWEB000235: Allocate exception for servlet com.sopra.banking.compliance.shsg.ui.rest.jaxrs.application.JaxrsApplication: java.lang.NoClassDefFoundError: Could not initialize class com.sopra.framework.rest.swagger.sbf.SbfJaxrsApplication
at com.sopra.banking.compliance.shsg.ui.rest.jaxrs.application.JaxrsApplication.(JaxrsApplication.java:33) [classes:]
at com.sopra.banking.compliance.shsg.ui.rest.jaxrs.application.JaxrsApplication$Proxy$_$$_WeldClientProxy.(JaxrsApplication$Proxy$_$$_WeldClientProxy.java) [classes:]
at sun.reflect.GeneratedConstructorAccessor173.newInstance(Unknown Source) [:1.8.0_202]

Anonymous said...

Hey man, thanks for the article. After reading it, it only took me 2 hours to solve a bug I was dealing with.

m@zi said...

Need help with:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/net/ssl/internal/ssl/Provider
run with openjdk 14.0.2 and 15.0.1 and still the same issue

running fine with Oracle Java “1.8.0_281”

javin paul said...

I think, you may need to enable some JVM option to include these classes, I am not sure but SSL things are sometime driven with JVM options.

Unknown said...

Mera use nahe ho raha ha

Anonymous said...

even though class is present i am getting this error. not able find solution anywhere can anybody please help:
java.lang.NoClassDefFoundError: Could not initialize class org.neo4j.configuration.GraphDatabaseSettings

at org.neo4j.harness.internal.AbstractInProcessNeo4jBuilder.setDirectory(AbstractInProcessNeo4jBuilder.java:289)
at org.neo4j.harness.internal.AbstractInProcessNeo4jBuilder.setWorkingDirectory(AbstractInProcessNeo4jBuilder.java:272)
at org.neo4j.harness.internal.AbstractInProcessNeo4jBuilder.withWorkingDir(AbstractInProcessNeo4jBuilder.java:97)
at org.neo4j.harness.internal.InProcessNeo4jBuilder.(InProcessNeo4jBuilder.java:42)
at org.neo4j.harness.internal.InProcessNeo4jBuilder.(InProcessNeo4jBuilder.java:37)

Anonymous said...

Hi Guy,

I'm trying to update the jackson_version to its updated version and while trying to clean and build I'm getting an
java.lang.NoClassDefFoundError at JsonConverterTest.java:87
Caused by: java.lang.ClassNotFoundException at JsonConverterTest.java:87

I guess the above error I'm getting is similar to the one mentioned above in the 9th point . But I'm not sure about the right cause of it .

It would be so helpful for me if someone could give me a solution on how to resolve this error .

Anonymous said...

Exception in thread "main" java.lang.NoClassDefFoundError: dev/failsafe/Policy
at org.seleniumhq.selenium.http/org.openqa.selenium.remote.http.ClientConfig.(ClientConfig.java:33)
at org.seleniumhq.selenium.chrome_driver/org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:84)
at org.seleniumhq.selenium.chrome_driver/org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:52)

I have added failsafe jar as well . but stil getting error while executing below program

System.setProperty("webdriver.chrome.driver", "C:\\Users\\hp\\Documents\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.co.in");

javin paul said...

Hello Anonymous, how are you running the program? are you using IDE or you are making Maven build or Gradle build? Also how are you adding JAR into classpath. Can you provide bit more context?

«Oldest ‹Older   201 – 237 of 237   Newer› Newest»

Post a Comment