Questions tagged [classnotfoundexception]

The Java exception thrown when an application tries to load a class by name but is not able to find the class.

The Java exception thrown when an application tries to load a class by name. Usually raised by one of:

  • the forName(String) method in class Class
  • the findSystemClass(String) method in class ClassLoader
  • the loadClass(String) method in class ClassLoader

when no definition for the class with the specified name could be found in the .

Don't confuse it with , it's a different kind of error, see the following links for more details:

2221 questions
41
votes
7 answers

Resolving dependency problems in Apache Spark

The common problems when building and deploying Spark applications are: java.lang.ClassNotFoundException. object x is not a member of package y compilation errors. java.lang.NoSuchMethodError How these can be resolved?
39
votes
1 answer

java.lang.ClassNotFoundException after changing nothing in the project but upgrading eclipse android sdk

Some time ago I developed a rather simple app, with a target of 4.2.2. I had it working normally in my device. Then I stopped development for about 1 month. After the recent Google I/O, I decided to come back to development. What I first did was…
Jago
  • 2,751
  • 4
  • 27
  • 41
35
votes
11 answers

ClassNotFoundException: Didn't find class on path: DexPathList

I have a problem since I updated my App on playstore. Since this update, the exception is thrown, but I haven´t changed anything related to this exception. Stacktrace: java.lang.RuntimeException: Unable to instantiate activity…
Opiatefuchs
  • 9,800
  • 2
  • 36
  • 49
34
votes
9 answers

Android ClassNotFoundException

I am having a problem with one of my apps and I was wondering if anyone could give me any insight into what maybe causing it. I am getting a ClassNotFoundException, the important line below is E/AndroidRuntime(21982): Caused by:…
Dori
  • 18,283
  • 17
  • 74
  • 116
34
votes
9 answers

ClassNotFoundException vs NoClassDefFoundError

I have gone through this thread What causes and what are the differences between NoClassDefFoundError and ClassNotFoundException? This is what one of the ans,which has max ups, in thread is : NoClassDefFoundError :"So, it appears that the…
Deen John
  • 3,522
  • 4
  • 29
  • 32
31
votes
8 answers

Unable to resolve superclass error when referencing .jar library

I did an Android project and run it. It ran successfully. I developed a web service in Java and hosted it. It ran successfully. I exported the webservice into a .jar and added it to my Android project. When I try to call a method in the web…
sakthi
  • 339
  • 1
  • 3
  • 7
30
votes
14 answers

A child container failed during start java.util.concurrent.ExecutionException

I tried to create/run a basic JSP and ran into the following error. I saw that other people have had similar problems, however, I haven't been able to find (or properly implement) a solution to the problem at hand yet. Any help would be…
zzz2991
  • 717
  • 3
  • 11
  • 20
29
votes
7 answers

Android: Instrumentation run failed due to 'java.lang.ClassNotFoundException': No tests found

I try to run a instrumentation test via "gradlew connectedAndroidTest". I get following error: Tests on GT-I9305 - 4.3 failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException' com.android.builder.testing.ConnectedDevice >…
29
votes
9 answers

android.content.ActivityNotFoundException: Unable to find explicit activity class

I get this error: 06-06 10:45:19.685: E/AndroidRuntime(554): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.Android.myApp/com.Android.myApp.Facebook.Example}; have you declared this activity in your…
Housefly
  • 4,324
  • 11
  • 43
  • 70
27
votes
3 answers

bouncycastle provider can't find classes needed for algorithm

I'm trying to use bouncycastle to encrypt a file using a public key. I've registered the provider programatically: Security.addProvider(new BouncyCastleProvider()); I created the public key object successfully. when i get to encrypting the file…
Sam
  • 305
  • 1
  • 3
  • 6
26
votes
3 answers

How to catch java.lang.NoClassDefFoundError?

I made an application which take elf file(*.a and *.o) and give list of methods name, but if someone renames any file into *.a or *.o then it will show: Exception occurred during event dispatching: java.lang.NoClassDefFoundError:…
Ashish
  • 1,527
  • 4
  • 17
  • 33
26
votes
5 answers

KeyCloak Server Caused by: java.lang.ClassNotFoundException: java.security.acl.Group

I'm running a KeyCloak server to authenticate users who would like to gain access to a Spring Boot/Spring Web REST API. However, an error occurs while trying to authenticate. The following works: When I access…
26
votes
5 answers

Java can't find main class

I have written the following Java source file (Hello.java): package com; public class Hello { public static void main(String[] args) { System.out.println("Hello!"); } } I save this to C:/tmpjava/Hello.java. From the command line, I…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
25
votes
4 answers

ClassNotFoundException DispatcherServlet when launching Tomcat (Maven dependencies not copied to wtpwebapps)

I've run into this problem a few times and only just stumbled upon a (semi-) reliable solution, so thought I would post it here in case it helps anyone else, or in case I forget it, and also to ask if anyone has any idea what the underlying cause is…
Russell
  • 12,261
  • 4
  • 52
  • 75
25
votes
13 answers

How to install JDBC driver in Eclipse web project without facing java.lang.ClassNotFoundexception

There is a VERY similar question to mine but in my case I don't have any duplicate jars in my build path, so the solution does not work for me. I've searched google for a couple of hours now, but none of the solutions I've found there actually…
Kiril
  • 39,672
  • 31
  • 167
  • 226