I am getting ClassNotFoundException
and NoClassDefFoundError
exceptions when I attempt to run my application using a maven defined dependency.
I added my maven dependency for the jar in question to my pom.xml
file with the following declaration:
<dependency>
<groupId>spy</groupId>
<artifactId>spymemcached</artifactId>
<version>2.8.4</version>
<scope>provided</scope>
</dependency>
This added the relevant JAR file to my Maven Dependencies folder in Eclipse. I can access the classes in code but I get the mentioned exceptions once I run the application.
The jar is referenced in my Java build path under Maven dependencies:
My local maven repository is added to my classpath:
When I attempt to run the application, I get the following two exceptions:
java.lang.NoClassDefFoundError: Lnet/spy/memcached/MemcachedClient;
java.lang.ClassNotFoundException: net.spy.memcached.MemcachedClient
Can anyone point me in the right direction?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…