Hi All,

I am using Spymemcached and my memcached server is running with SASL 
support enabled. At memcached client initalization code, there is a NPE 
coming:

Exception Stacktrace for the same is :


Exception in thread "main" java.lang.NullPointerException
    at net.spy.memcached.MemcachedClient.addObserver(MemcachedClient.java:
2482)
    at net.spy.memcached.MemcachedClient.<init>(MemcachedClient.java:280)
    at net.spy.memcached.MemcachedClient.<init>(MemcachedClient.java:219)

Looks like it's failing even before it connects to Memcached server. Is 
there any other configuration I need to specify in my code for connecting?

The command used to start memcached server is:

memcached -u nobody -m 1024 -p 8010 -S -B binary -vvv
Initialized SASL.


Here's the test code I am using:

public class MemcachedTest {
    public static void main(String[] args) {
        AuthDescriptor ad = new AuthDescriptor(new String[] { "PLAIN" },
                new PlainCallbackHandler(
                        "[email protected]", "memcached"));
        ConnectionFactory connFactory = new ConnectionFactoryBuilder()
                .setProtocol(ConnectionFactoryBuilder.Protocol.BINARY)
                .setAuthDescriptor(ad).build();

        List<InetSocketAddress> servers = AddrUtil
                .getAddresses("localhost:8010");
        MemcachedClient cacheClient = null;
        try {
            cacheClient = new MemcachedClient(connFactory, servers);
            cacheClient.set("foo", 50000, "bar");
            System.out.println("From cachelandia: " + cacheClient.get("foo"
));
        } catch (IOException iox) {
            iox.printStackTrace();

        }
    }
}


Any pointer on how this issue can be resolved will be really helpful.

Thanks!
Param

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to