ClassNotFoundException / NoClassDefFoundError MemcachedClient

462 views
Skip to first unread message

Daniel Watrous

unread,
Sep 21, 2012, 5:18:22 PM9/21/12
to spymem...@googlegroups.com
I've been trying to get a simple example working with spymemcached, but I'm getting an exception that I can't solve.

This is the class I'm trying to 

package com.mycompany.testredis;

import java.io.IOException;
import java.net.InetSocketAddress;
import net.spy.memcached.MemcachedClient;

public class MemcachedTest {
    public static void main( String[] args ) throws IOException
    {
        InetSocketAddress memcachedAddr = new InetSocketAddress("d1t0028g.austin.hp.com", 11211);
        MemcachedClient c = new MemcachedClient(memcachedAddr);

        String mvalue = "Hewlett Packard";
        c.set("someKey", 60, mvalue);

        String myObject = (String)c.get("someKey");
        System.out.println(myObject);
    }
}

It's a basic Java app in netbeans using Maven. The jar was downloaded and obviously loads into the netbeans environment.

http://screencast.com/t/AuXgeCKMTfqf

Here's the entire stacktrace that shows in the output:
run:
Exception in thread "main" java.lang.NoClassDefFoundError: net/spy/memcached/MemcachedClient
at com.mycompany.testredis.MemcachedTest.main(MemcachedTest.java:11)
Caused by: java.lang.ClassNotFoundException: net.spy.memcached.MemcachedClient
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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 1 more
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Any ideas?
Reply all
Reply to author
Forward
0 new messages