I have added maven dependency to Pom.xml and I can see the class exists in Maven dependencies but when I run the application it is throwing ClassNotFoundException.
Asked
Active
Viewed 137 times
0
-
Call `dependency:list` and confirm that the desired jar is in the list (in the correct version). – J Fabian Meier Sep 07 '17 at 15:11
-
You are missing a dependency...best would be to past text into the question instead of links to images cause some people are not allowed to read those images...and can not help....furthermore have you added the dependency in dependencies or in dependencyManagement ? Best would be to post the pom file here... – khmarbaise Sep 07 '17 at 16:43
-
How are you running your application? Declaring the dependency in maven provides it at build time. Whether or not it is available at runtime depends upon what type of application it is. – Steve C Sep 08 '17 at 08:43
2 Answers
0
Sometimes Java will report that it cannot find a class when, in reality, an exception occurred while it tried to load the class definition into memory. This can occur if:
- A static initializer throws an exception
- A base class or interface is missing
Try setting a breakpoint in the DefaultDirectoryService constructor and running your application in debug mode. You should be able to see what is causing your issue.

Faron
- 1,354
- 10
- 23
-1
looks like your using Eclipse.
Go to your project path in command line and execute mvn eclipse:eclipse
.
If you don't have Maven installed locally you can download it from here

Jorge Chavez
- 125
- 6
-
`mvn eclipse:eclipse` is long time deprecated better use M2E Integration in Eclipse... – khmarbaise Sep 07 '17 at 16:43